linux-stable/drivers
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
..
accel
accessibility
acpi ACPI: FPDT: properly handle invalid FPDT subtables 2023-11-28 17:15:06 +00:00
amba
android
ata
atm
auxdisplay
base regmap: Ensure range selector registers are updated after cache sync 2023-11-28 17:15:02 +00:00
bcma
block
bluetooth
bus
cdrom
cdx
char parisc/agp: Use 64-bit LE values in SBA IOMMU PDIR table 2023-11-28 17:15:03 +00:00
clk clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks 2023-11-28 17:15:04 +00:00
clocksource
comedi
connector
counter
cpufreq cpufreq: stats: Fix buffer overflow detection in trans_stats() 2023-11-28 17:15:03 +00:00
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma
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:15:05 +00:00
fpga
fsi
gnss
gpio
gpu i915/perf: Fix NULL deref bugs with drm_dbg() calls 2023-11-28 17:14:58 +00:00
greybus
hid
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
infiniband
input
interconnect
iommu iommufd: Fix missing update of domains_itree after splitting iopt_area 2023-11-28 17:15:01 +00:00
ipack
irqchip
isdn
leds leds: trigger: netdev: Move size check in set_device_name 2023-11-28 17:15:06 +00:00
macintosh
mailbox
mcb
md dm crypt: account large pages in cc->n_allocated_pages 2023-11-28 17:15:01 +00:00
media media: venus: hfi: add checks to perform sanity on queue pointers 2023-11-28 17:14:58 +00:00
memory
memstick
message
mfd mfd: qcom-spmi-pmic: Fix revid implementation 2023-11-28 17:15:06 +00:00
misc
mmc mmc: Add quirk MMC_QUIRK_BROKEN_CACHE_FLUSH for Micron eMMC Q2J54A 2023-11-28 17:15:04 +00:00
most
mtd mtd: rawnand: meson: check return value of devm_kasprintf() 2023-11-28 17:14:52 +00:00
mux
net wifi: wilc1000: use vmm_table as array in wilc struct 2023-11-28 17:15:04 +00:00
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc parisc/power: Add power soft-off when running on qemu 2023-11-28 17:15:03 +00:00
parport
pci PCI: exynos: Don't discard .remove() callback 2023-11-28 17:15:04 +00:00
pcmcia
peci
perf drivers: perf: Check find_first_bit() return value 2023-11-28 17:14:58 +00:00
phy
pinctrl
platform
pnp
power
powercap powercap: intel_rapl: Downgrade BIOS locked limits pr_warn() to pr_debug() 2023-11-28 17:15:03 +00:00
pps
ps3
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 17:14:55 +00:00
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi scsi: qla2xxx: Fix system crash due to bad pointer access 2023-11-28 17:14:59 +00:00
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal thermal: intel: powerclamp: fix mismatch in get function for max_idle 2023-11-28 17:15:05 +00:00
thunderbolt
tty hvc/xen: fix event channel handling for secondary consoles 2023-11-28 17:15:00 +00:00
ufs scsi: ufs: core: Fix racing issue between ufshcd_mcq_abort() and ISR 2023-11-28 17:14:59 +00:00
uio
usb
vdpa vdpa_sim_blk: allocate the buffer zeroed 2023-11-28 17:14:53 +00:00
vfio
vhost vhost-vdpa: fix use after free in vhost_vdpa_probe() 2023-11-28 17:14:53 +00:00
video
virt
virtio
vlynq
w1
watchdog
xen xen/events: fix delayed eoi list handling 2023-11-28 17:14:55 +00:00
zorro
Kconfig
Makefile