linux-stable/drivers/mfd
Johan Hovold 4ce77b023d mfd: qcom-spmi-pmic: Fix revid implementation
commit 7b439aaa62 upstream.

The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.

First, it assumes that just because the sibling base device has been
registered that means that it is also bound to a driver, which may not
be the case (e.g. due to probe deferral or asynchronous probe). This
could trigger a NULL-pointer dereference when attempting to access the
driver data of the unbound device.

Second, it accesses driver data of a sibling device directly and without
any locking, which means that the driver data may be freed while it is
being accessed (e.g. on driver unbind).

Third, it leaks a struct device reference to the sibling device which is
looked up using the spmi_device_from_of() every time a function (child)
device is calling the revid function (e.g. on probe).

Fix this mess by reimplementing the revid lookup so that it is done only
at probe of the PMIC device; the base device fetches the revid info from
the hardware, while any secondary SPMI device fetches the information
from the base device and caches it so that it can be accessed safely
from its children. If the base device has not been probed yet then probe
of a secondary device is deferred.

Fixes: e9c11c6e3a ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
Cc: stable@vger.kernel.org      # 6.0
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-3-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-28 17:15:06 +00:00
..
88pm80x.c mfd: Remove redundant dev_set_drvdata() from I2C drivers 2023-06-15 09:19:37 +01:00
88pm800.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
88pm805.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
88pm860x-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
88pm860x-i2c.c
Kconfig mfd: rk808: Make MFD_RK8XX tristate 2023-09-13 09:53:47 +02:00
Makefile mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support 2023-06-21 18:16:18 +01:00
aat2870-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
ab8500-core.c
ab8500-sysctrl.c
abx500-core.c
ac100.c
acer-ec-a500.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
act8945a.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
adp5520.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
altera-a10sr.c
altera-sysmgr.c
arizona-core.c
arizona-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
arizona-irq.c
arizona-spi.c mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs 2023-11-20 11:57:11 +01:00
arizona.h
as3711.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
as3722.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
at91-usart.c
atc260x-core.c
atc260x-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
atmel-flexcom.c
atmel-hlcdc.c
atmel-smc.c
axp20x-i2c.c mfd: axp20x: Add support for AXP192 2023-06-15 09:19:37 +01:00
axp20x-rsb.c
axp20x.c mfd: axp20x: Add support for AXP192 2023-06-15 09:19:37 +01:00
bcm590xx.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
bcm2835-pm.c
bd9571mwv.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
cros_ec_dev.c
cs47l15-tables.c
cs47l24-tables.c
cs47l35-tables.c
cs47l85-tables.c
cs47l90-tables.c
cs47l92-tables.c
cs5535-mfd.c
da903x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
da9052-core.c
da9052-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
da9052-irq.c
da9052-spi.c
da9055-core.c
da9055-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
da9062-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
da9063-core.c
da9063-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
da9063-irq.c
da9150-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
db8500-prcmu-regs.h
db8500-prcmu.c
dln2.c mfd: dln2: Fix double put in dln2_probe 2023-11-20 11:57:11 +01:00
ene-kb3930.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
exynos-lpass.c
ezx-pcap.c
fsl-imx25-tsadc.c
gateworks-gsc.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
hi655x-pmic.c
hi6421-pmic-core.c
hi6421-spmi-pmic.c
intel-lpss-acpi.c mfd: intel-lpss: Add missing check for platform_get_resource 2023-06-15 09:19:39 +01:00
intel-lpss-pci.c mfd: intel-lpss: Add Intel Lunar Lake-M PCI IDs 2023-11-28 17:14:49 +00:00
intel-lpss.c mfd: intel-lpss: Hide suspend/resume functions in #ifdef 2023-06-15 09:19:37 +01:00
intel-lpss.h
intel-m10-bmc-core.c mfd: intel-m10-bmc: Manage access to MAX 10 fw handshake registers 2023-06-15 09:19:36 +01:00
intel-m10-bmc-pmci.c mfd: intel-m10-bmc: Move core symbols to own namespace 2023-06-15 09:19:36 +01:00
intel-m10-bmc-spi.c mfd: intel-m10-bmc: Manage access to MAX 10 fw handshake registers 2023-06-15 09:19:36 +01:00
intel_pmc_bxt.c
intel_quark_i2c_gpio.c
intel_soc_pmic_bxtwc.c
intel_soc_pmic_chtdc_ti.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
intel_soc_pmic_chtwc.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
intel_soc_pmic_crc.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
intel_soc_pmic_mrfld.c
ioc3.c
ipaq-micro.c
iqs62x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
janz-cmodio.c
kempld-core.c
khadas-mcu.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lm3533-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lm3533-ctrlbank.c
lochnagar-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lp873x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lp3943.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lp8788-irq.c
lp8788.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lp87565.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
lpc_ich.c
lpc_sch.c
madera-core.c
madera-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
madera-spi.c
madera.h
max8907.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max8925-core.c
max8925-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max8997-irq.c
max8997.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max8998-irq.c
max8998.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max14577.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max77541.c mfd: Switch two more drivers back to use struct i2c_driver::probe 2023-06-26 16:38:30 +01:00
max77620.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max77650.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max77686.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max77693.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max77714.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
max77843.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
mc13xxx-core.c
mc13xxx-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
mc13xxx-spi.c
mc13xxx.h
mcp-core.c
mcp-sa11x0.c
menelaus.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
menf21bmc.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
mfd-core.c mfd: core: Ensure disabled devices are skipped without aborting 2023-11-20 11:57:11 +01:00
motorola-cpcap.c
mp2629.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
mt6358-irq.c
mt6360-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
mt6370.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
mt6370.h
mt6397-core.c
mt6397-irq.c
mxs-lradc.c
ntxec.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
ocelot-core.c
ocelot-spi.c
ocelot.h
omap-usb-host.c
omap-usb-tll.c
omap-usb.h
palmas.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
pcf50633-adc.c
pcf50633-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
pcf50633-gpio.c
pcf50633-irq.c
qcom-pm8xxx.c
qcom-pm8008.c mfd: pm8008: Drop bogus i2c module alias 2023-06-15 09:19:38 +01:00
qcom-spmi-pmic.c mfd: qcom-spmi-pmic: Fix revid implementation 2023-11-28 17:15:06 +00:00
qcom_rpm.c
rave-sp.c
rc5t583-irq.c mfd: rc5t583-irq: Remove the unneeded include <linux/i2c.h> 2023-06-15 09:19:36 +01:00
rc5t583.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rdc321x-southbridge.c
retu-mfd.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rk8xx-core.c mfd: rk8xx: Add rk806 support 2023-05-15 16:20:22 +01:00
rk8xx-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rk8xx-spi.c mfd: rk8xx: Add rk806 support 2023-05-15 16:20:22 +01:00
rn5t618.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rohm-bd718x7.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rohm-bd9576.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rohm-bd71828.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rsmu.h
rsmu_core.c
rsmu_i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rsmu_spi.c
rt4831.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rt5033.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rt5120.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
rz-mtu3.c
rz-mtu3.h
sec-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
sec-irq.c
si476x-cmd.c
si476x-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
si476x-prop.c
simple-mfd-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
simple-mfd-i2c.h
sky81452.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
sm501.c
smpro-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
sprd-sc27xx-spi.c
ssbi.c
sta2x11-mfd.c
stm32-lptimer.c
stm32-timers.c
stmfx.c mfd: stmfx: Nullify stmfx->vdd in case of error 2023-06-15 15:05:49 +01:00
stmpe-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
stmpe-spi.c
stmpe.c mfd: stmpe: Only disable the regulators if they are enabled 2023-06-21 18:45:37 +01:00
stmpe.h
stpmic1.c mfd: stpmic1: Add PMIC poweroff via sys-off handler 2023-06-15 09:19:39 +01:00
stw481x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
sun4i-gpadc.c
sun6i-prcm.c
syscon.c
tc3589x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
ti-lmu.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
ti_am335x_tscadc.c
timberdale.c
timberdale.h
tps6105x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps6507x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps6586x.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps6594-core.c mfd: tps6594: Add driver for TI TPS6594 PMIC 2023-05-18 16:06:14 +01:00
tps6594-i2c.c mfd: Switch two more drivers back to use struct i2c_driver::probe 2023-06-26 16:38:30 +01:00
tps6594-spi.c mfd: tps6594: Fix an error code in probe() 2023-06-15 09:19:38 +01:00
tps65010.c - New Drivers 2023-07-03 10:55:04 -07:00
tps65086.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps65090.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps65217.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps65218.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps65219.c mfd: tps65219: Add support for soft shutdown via sys-off API 2023-06-15 09:19:38 +01:00
tps65910.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps65911-comparator.c
tps65912-core.c
tps65912-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
tps65912-spi.c
tqmx86.c
twl-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
twl-core.h
twl4030-audio.c
twl4030-irq.c
twl4030-power.c
twl6030-irq.c
twl6040.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
ucb1x00-assabet.c
ucb1x00-core.c
ucb1x00-ts.c
vexpress-sysreg.c
viperboard.c
vx855.c
wcd934x.c mfd: wcd934x: Simplify with dev_err_probe() 2023-06-15 09:19:38 +01:00
wl1273-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
wm97xx-core.c
wm831x-auxadc.c
wm831x-core.c mfd: wm831x: Use maple tree register cache 2023-06-15 09:19:36 +01:00
wm831x-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
wm831x-irq.c
wm831x-otp.c
wm831x-spi.c
wm5102-tables.c
wm5110-tables.c
wm8350-core.c
wm8350-gpio.c
wm8350-i2c.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
wm8350-irq.c
wm8350-regmap.c
wm8400-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
wm8994-core.c mfd: Switch i2c drivers back to use .probe() 2023-06-15 09:19:37 +01:00
wm8994-irq.c
wm8994-regmap.c
wm8994.h
wm8997-tables.c
wm8998-tables.c