linux/drivers/i2c
Pratap Nirujogi e2f1ada8e0
i2c: designware: amdisp: Fix resume-probe race condition issue
Identified resume-probe race condition in kernel v7.0 with the commit
38fa29b01a ("i2c: designware: Combine the init functions"),but this
issue existed from the beginning though not detected.

The amdisp i2c device requires ISP to be in power-on state for probe
to succeed. To meet this requirement, this device is added to genpd
to control ISP power using runtime PM. The pm_runtime_get_sync() called
before i2c_dw_probe() triggers PM resume, which powers on ISP and also
invokes the amdisp i2c runtime resume before the probe completes resulting
in this race condition and a NULL dereferencing issue in v7.0

Fix this race condition by using the genpd APIs directly during probe:
  - Call dev_pm_genpd_resume() to Power ON ISP before probe
  - Call dev_pm_genpd_suspend() to Power OFF ISP after probe
  - Set the device to suspended state with pm_runtime_set_suspended()
  - Enable runtime PM only after the device is fully initialized

Fixes: d6263c468a ("i2c: amd-isp: Add ISP i2c-designware driver")
Co-developed-by: Bin Du <bin.du@amd.com>
Signed-off-by: Bin Du <bin.du@amd.com>
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
Cc: <stable@vger.kernel.org> # v6.16+
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260320201302.3490570-1-pratap.nirujogi@amd.com
2026-03-27 13:51:21 +01:00
..
algos i2c: pcf8584: Change pcf_doAdress() to pcf_send_address() 2025-10-28 17:05:39 +01:00
busses i2c: designware: amdisp: Fix resume-probe race condition issue 2026-03-27 13:51:21 +01:00
muxes i2c: muxes: pca954x: Fix broken reset-gpio usage 2025-11-03 18:04:15 +01:00
Kconfig i2c: Remove I2C_COMPAT config symbol and related code 2024-09-07 18:31:28 +02:00
Makefile i2c: Introduce OF component probe function 2024-11-27 12:04:10 +01:00
i2c-atr.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-boardinfo.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-core-acpi.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-core-base.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-core-of-prober.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-core-of.c i2c: core: Do not dereference fwnode in struct device 2025-04-16 18:08:32 +02:00
i2c-core-slave.c i2c: core: Use fwnode_for_each_child_node_scoped() 2025-09-10 14:49:45 +02:00
i2c-core-smbus.c i2c: Use str_read_write() helper 2025-05-23 17:28:07 +02:00
i2c-core.h i2c: Unexport i2c_of_match_device() 2025-02-13 16:47:52 +01:00
i2c-dev.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
i2c-mux.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-slave-eeprom.c sysfs: treewide: switch back to bin_attribute::read()/write() 2025-06-17 10:44:13 +02:00
i2c-slave-testunit.c i2c: testunit: on errors, repeat NACK until STOP 2025-01-15 19:44:21 +01:00
i2c-smbus.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-stub.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00