[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220510130733.661922005@linuxfoundation.org>
Date: Tue, 10 May 2022 15:07:24 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Yang Yingliang <yangyingliang@...wei.com>,
Samuel Holland <samuel@...lland.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 4.14 38/78] clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource()
From: Yang Yingliang <yangyingliang@...wei.com>
[ Upstream commit f58ca215cda1975f77b2b762903684a3c101bec9 ]
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.
Fixes: 7a6fca879f59 ("clk: sunxi: Add driver for A80 MMC config clocks/resets")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
Reviewed-by: Samuel Holland <samuel@...lland.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@...il.com>
Link: https://lore.kernel.org/r/20220421134308.2885094-1-yangyingliang@huawei.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/clk/sunxi/clk-sun9i-mmc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/sunxi/clk-sun9i-mmc.c b/drivers/clk/sunxi/clk-sun9i-mmc.c
index f69f9e8c6f38..7e9d1624032f 100644
--- a/drivers/clk/sunxi/clk-sun9i-mmc.c
+++ b/drivers/clk/sunxi/clk-sun9i-mmc.c
@@ -117,6 +117,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)
spin_lock_init(&data->lock);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!r)
+ return -EINVAL;
/* one clock/reset pair per word */
count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
data->membase = devm_ioremap_resource(&pdev->dev, r);
--
2.35.1
Powered by blists - more mailing lists