public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] soc: fsl: qe: Fix potential NULL pointer dereference in qe_reset()
@ 2026-03-10 12:11 Wang Jun
  2026-03-13  9:48 ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Jun @ 2026-03-10 12:11 UTC (permalink / raw)
  To: Qiang Zhao, Christophe Leroy, linuxppc-dev, linux-arm-kernel
  Cc: linux-kernel, gszhai, 25125332, 25125283, 23120469, Wang Jun

The function qe_reset() uses qe_immr without checking if it is NULL,
which could happen if ioremap() failed earlier. Add a NULL check and
perform ioremap() if needed; if it still fails, print an error and
return to avoid crashing the system.

Signed-off-by: Wang Jun <1742789905@qq.com>
---
 drivers/soc/fsl/qe/qe.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c
index 70b6eddb867b..6dcfa340970a 100644
--- a/drivers/soc/fsl/qe/qe.c
+++ b/drivers/soc/fsl/qe/qe.c
@@ -86,8 +86,13 @@ static phys_addr_t get_qe_base(void)
 
 void qe_reset(void)
 {
-	if (qe_immr == NULL)
+	if (qe_immr == NULL) {
 		qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE);
+		if (qe_immr == NULL) {
+			pr_err("QE: cannot remap IMMR\n");
+			return;
+		}
+	}
 
 	qe_snums_init();
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-28 12:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 12:11 [PATCH] soc: fsl: qe: Fix potential NULL pointer dereference in qe_reset() Wang Jun
2026-03-13  9:48 ` Christophe Leroy (CS GROUP)
     [not found]   ` <tencent_89405091B7744EA070AC53E11A3FFA355609@qq.com>
2026-03-24 13:47     ` [PATCH] soc: fsl: qe: Fix potential NULL pointer dereference inqe_reset() Christophe Leroy (CS GROUP)
2026-03-27  0:12       ` [PATCH v2] soc: fsl: qe: panic on ioremap() failure in qe_reset() Wang Jun
2026-03-28 12:09         ` Christophe Leroy (CS GROUP)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox