[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1671747798-12935-1-git-send-email-khoroshilov@ispras.ru>
Date: Fri, 23 Dec 2022 01:23:18 +0300
From: Alexey Khoroshilov <khoroshilov@...ras.ru>
To: Geert Uytterhoeven <geert+renesas@...der.be>,
Chris Brandt <chris.brandt@...esas.com>
Cc: Alexey Khoroshilov <khoroshilov@...ras.ru>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
linux-renesas-soc@...r.kernel.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: [PATCH] clk: renesas: cpg-mssr: Fix use after free if cpg_mssr_common_init() failed
If cpg_mssr_common_init() fails after assigning priv to global variable
cpg_mssr_priv, it deallocates priv, but cpg_mssr_priv keeps dangling
pointer that potentially can be used later.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 1f7db7bbf031 ("clk: renesas: cpg-mssr: Add early clock support")
Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
---
drivers/clk/renesas/renesas-cpg-mssr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 1a0cdf001b2f..27da127ca4a8 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -1025,6 +1025,7 @@ static int __init cpg_mssr_common_init(struct device *dev,
if (priv->base)
iounmap(priv->base);
kfree(priv);
+ cpg_mssr_priv = NULL;
return error;
}
--
2.7.4
Powered by blists - more mailing lists