Re: [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume
From: Mario Limonciello
Date: Mon Mar 09 2026 - 21:29:23 EST
On 3/9/2026 5:00 PM, Pratap Nirujogi wrote:
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@xxxxxxx>
Fixes: 02c057ddefef ("ACPI: video: Convert the driver to a platform one")
Is this the right commit that introduced the race? Did it change the timing?
Or was the race always there and we just got lucky until that commit went in?
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@xxxxxxx>
---
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;
}