All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume
@ 2026-03-09 22:00 Pratap Nirujogi
  2026-03-10  1:29 ` Mario Limonciello
  2026-03-10 11:21 ` Andy Shevchenko
  0 siblings, 2 replies; 9+ messages in thread
From: Pratap Nirujogi @ 2026-03-09 22:00 UTC (permalink / raw)
  To: andi.shyti, mika.westerberg, andriy.shevchenko, jsd
  Cc: rafael.j.wysocki, mlimonci, benjamin.chan, bin.du, king.li,
	linux-i2c, linux-kernel, Pratap Nirujogi, Bin Du

Add NULL check for i_dev->map before calling i2c_dw_init() in the
runtime resume path. The regmap may not be initialized yet when
runtime PM tries to resume the device early in the probe sequence,
leading to a NULL pointer dereference. Skip the i2c_dw_init() call
if regmap is not yet created.

This race condition occurs when runtime PM resume is triggered before
i2c_dw_probe() completes the regmap initialization and was observed in
kernel v7.0 where the order of device enumeration has changed because
of the changes in registering the device sources in the device hierarchy.

Co-developed-by: Bin Du <Bin.Du@amd.com>
Fixes: 02c057ddefef ("ACPI: video: Convert the driver to a platform one")
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
---
 drivers/i2c/busses/i2c-designware-amdisp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-amdisp.c b/drivers/i2c/busses/i2c-designware-amdisp.c
index c48728ad9f6f2..cd7ee55fbe1ee 100644
--- a/drivers/i2c/busses/i2c-designware-amdisp.c
+++ b/drivers/i2c/busses/i2c-designware-amdisp.c
@@ -153,7 +153,10 @@ static int amd_isp_dw_i2c_plat_runtime_resume(struct device *dev)
 		return -ENODEV;
 
 	i2c_dw_prepare_clk(i_dev, true);
-	i2c_dw_init(i_dev);
+
+	/* Skip i2c_dw_init if regmap not yet created by i2c_dw_probe */
+	if (i_dev->map)
+		i2c_dw_init(i_dev);
 
 	return 0;
 }
-- 
2.43.0


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

end of thread, other threads:[~2026-03-20 15:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 22:00 [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume Pratap Nirujogi
2026-03-10  1:29 ` Mario Limonciello
2026-03-19 21:09   ` Nirujogi, Pratap
2026-03-20  7:59     ` Andy Shevchenko
2026-03-20 15:38       ` Nirujogi, Pratap
2026-03-20 13:56     ` Mario Limonciello
2026-03-20 15:40       ` Nirujogi, Pratap
2026-03-10 11:21 ` Andy Shevchenko
2026-03-19 21:24   ` Nirujogi, Pratap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.