linux-stable/drivers
Johan Hovold db98de0809 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:07:12 +00:00
..
accessibility
acpi ACPI: FPDT: properly handle invalid FPDT subtables 2023-11-28 17:07:12 +00:00
amba
android
ata
atm atm: iphase: Do PCI error checks on own line 2023-11-28 17:07:00 +00:00
auxdisplay
base regmap: Ensure range selector registers are updated after cache sync 2023-11-28 17:07:09 +00:00
bcma
block virtio-blk: fix implicit overflow on virtio_max_dma_size 2023-11-28 17:07:02 +00:00
bluetooth Bluetooth: btusb: Add date->evt_skb is NULL check 2023-11-28 17:06:56 +00:00
bus
cdrom
char
clk clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks 2023-11-28 17:07:10 +00:00
clocksource clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware 2023-11-28 17:06:55 +00:00
comedi
connector
counter
cpufreq
cpuidle
crypto crypto: hisilicon/qm - prevent soft lockup in receive loop 2023-11-28 17:07:00 +00:00
cxl cxl/mem: Fix shutdown order 2023-11-20 11:52:13 +01:00
dax
dca
devfreq
dio
dma dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() 2023-11-20 11:52:10 +01:00
dma-buf
edac
eisa
extcon
firewire
firmware firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit 2023-11-28 17:07:12 +00:00
fpga
fsi
gnss
gpio
gpu i915/perf: Fix NULL deref bugs with drm_dbg() calls 2023-11-28 17:07:07 +00:00
greybus
hid HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W 2023-11-28 17:07:00 +00:00
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c i2c: dev: copy userspace array safely 2023-11-28 17:07:02 +00:00
i3c i3c: master: mipi-i3c-hci: Fix a kernel panic for accessing DAT_data. 2023-11-28 17:07:02 +00:00
idle
iio iio: adc: stm32-adc: harden against NULL pointer deref in stm32_adc_probe() 2023-11-28 17:07:01 +00:00
infiniband RDMA/hfi1: Use FIELD_GET() to extract Link Width 2023-11-28 17:06:59 +00:00
input Input: synaptics-rmi4 - fix use after free in rmi_unregister_function() 2023-11-20 11:52:15 +01:00
interconnect interconnect: qcom: sm8350: Set ACV enable_mask 2023-11-20 11:52:12 +01:00
iommu
ipack
irqchip
isdn
leds leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu' 2023-11-20 11:52:08 +01:00
macintosh
mailbox
mcb
md
media media: venus: hfi: add checks to perform sanity on queue pointers 2023-11-28 17:07:07 +00:00
memory
memstick
message
mfd mfd: qcom-spmi-pmic: Fix revid implementation 2023-11-28 17:07:12 +00:00
misc misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller 2023-11-28 17:07:00 +00:00
mmc mmc: Add quirk MMC_QUIRK_BROKEN_CACHE_FLUSH for Micron eMMC Q2J54A 2023-11-28 17:07:11 +00:00
most
mtd mtd: rawnand: meson: check return value of devm_kasprintf() 2023-11-28 17:07:03 +00:00
mux
net wifi: wilc1000: use vmm_table as array in wilc struct 2023-11-28 17:07:11 +00:00
nfc
ntb
nubus
nvdimm
nvme nvme: fix error-handling for io_uring nvme-passthrough 2023-11-20 11:52:17 +01:00
nvmem
of
opp
parisc parisc/power: Add power soft-off when running on qemu 2023-11-28 17:07:10 +00:00
parport
pci PCI: exynos: Don't discard .remove() callback 2023-11-28 17:07:11 +00:00
pcmcia pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:52:13 +01:00
peci
perf
phy
pinctrl pinctrl: renesas: rzg2l: Make reverse order of enable() for disable() 2023-11-20 11:52:10 +01:00
platform platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e 2023-11-28 17:06:56 +00:00
pnp
power
powercap
pps
ps3
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 17:07:05 +00:00
pwm pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume 2023-11-20 11:52:15 +01:00
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call 2023-11-20 11:52:13 +01:00
s390
sbus
scsi scsi: qla2xxx: Fix system crash due to bad pointer access 2023-11-28 17:07:07 +00:00
sh
siox
slimbus
soc
soundwire soundwire: dmi-quirks: update HP Omen match 2023-11-28 17:07:01 +00:00
spi spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies 2023-11-20 11:52:18 +01:00
spmi
ssb
staging media: cedrus: Fix clock/reset sequence 2023-11-20 11:52:14 +01:00
target
tc
tee
thermal
thunderbolt thunderbolt: Apply USB 3.x bandwidth quirk only in software connection manager 2023-11-28 17:07:01 +00:00
tty hvc/xen: fix event channel handling for secondary consoles 2023-11-28 17:07:08 +00:00
ufs scsi: ufs: core: Leave space for '\0' in utf8 desc string 2023-11-20 11:52:07 +01:00
uio
usb usb: gadget: f_ncm: Always set current gadget in ncm_bind() 2023-11-28 17:07:01 +00:00
vdpa
vfio
vhost vhost-vdpa: fix use after free in vhost_vdpa_probe() 2023-11-28 17:07:04 +00:00
video fbdev: fsl-diu-fb: mark wr_reg_wa() static 2023-11-20 11:52:18 +01:00
virt virt: sevguest: Fix passing a stack buffer as a scatterlist target 2023-11-20 11:52:13 +01:00
virtio
vlynq
w1
watchdog watchdog: ixp4xx: Make sure restart always works 2023-11-20 11:52:15 +01:00
xen xen/events: fix delayed eoi list handling 2023-11-28 17:07:05 +00:00
zorro
Kconfig
Makefile