linux-stable/drivers
Uwe Kleine-König d68601914e hwmon: (sht15) Fix wrong assumptions in device remove callback
[ Upstream commit 7d4edccc9b ]

Taking a lock at the beginning of .remove() doesn't prevent new readers.
With the existing approach it can happen, that a read occurs just when
the lock was taken blocking the reader until the lock is released at the
end of the remove callback which then accessed *data that is already
freed then.

To actually fix this problem the hwmon core needs some adaption. Until
this is implemented take the optimistic approach of assuming that all
readers are gone after hwmon_device_unregister() and
sysfs_remove_group() as most other drivers do. (And once the core
implements that, taking the lock would deadlock.)

So drop the lock, move the reset to after device unregistration to keep
the device in a workable state until it's deregistered. Also add a error
message in case the reset fails and return 0 anyhow. (Returning an error
code, doesn't stop the platform device unregistration and only results
in a little helpful error message before the devm cleanup handlers are
called.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220725194344.150098-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 14:23:04 +02:00
..
accessibility tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:25:32 +02:00
acpi ACPI: LPSS: Fix missing check in register_device_clock() 2022-08-17 14:23:03 +02:00
amba
android
ata
atm
auxdisplay
base x86/bugs: Report AMD retbleed vulnerability 2022-07-23 12:54:02 +02:00
bcma
block virtio-blk: modify the value type of num in virtio_queue_rq() 2022-07-12 16:35:11 +02:00
bluetooth Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3586 2022-08-11 13:07:54 +02:00
bus bus: mhi: host: pci_generic: add Telit FN990 2022-07-29 17:25:06 +02:00
cdrom
char
clk clk: renesas: r9a07g044: Update multiplier and divider values for PLL2/3 2022-07-12 16:34:58 +02:00
clocksource clocksource/drivers/ixp4xx: remove EXPORT_SYMBOL_GPL from ixp4xx_timer_setup() 2022-07-07 17:53:32 +02:00
comedi
connector
counter
cpufreq cpufreq: pmac32-cpufreq: Fix refcount leak bug 2022-07-21 21:24:34 +02:00
cpuidle
crypto crypto: ccp - Use kzalloc for sev ioctl interfaces to prevent kernel memory leak 2022-08-17 14:22:51 +02:00
cxl cxl/port: Hold port reference until decoder release 2022-07-12 16:34:58 +02:00
dax
dca
devfreq
dio
dma dmaengine: idxd: force wq context cleanup on device disable path 2022-07-12 16:35:19 +02:00
dma-buf dma-buf/poll: Get a file reference for outstanding fence callbacks 2022-07-12 16:34:51 +02:00
edac EDAC/ghes: Set the DIMM label unconditionally 2022-08-03 12:03:55 +02:00
eisa
extcon
firewire
firmware firmware: tegra: Fix error check return value of debugfs_create_file() 2022-08-17 14:23:04 +02:00
fpga
fsi fsi: occ: Force sequence numbering per OCC 2022-07-07 17:53:32 +02:00
gnss
gpio gpio: gpio-xilinx: Fix integer overflow 2022-07-29 17:25:23 +02:00
gpu drm/amdgpu: fix check in fbdev init 2022-08-17 14:22:54 +02:00
greybus
hid HID: wacom: Don't register pad_input for touch switch 2022-08-17 14:22:47 +02:00
hsi
hv
hwmon hwmon: (sht15) Fix wrong assumptions in device remove callback 2022-08-17 14:23:04 +02:00
hwspinlock
hwtracing coresight: Clear the connection field properly 2022-08-17 14:22:58 +02:00
i2c i2c: cadence: Change large transfer count reset logic to be unconditional 2022-07-29 17:25:17 +02:00
i3c
idle intel_idle: Disable IBRS during long idle 2022-07-23 12:54:04 +02:00
iio iio: light: isl29028: Fix the warning in isl29028_remove() 2022-08-17 14:22:55 +02:00
infiniband RDMA/irdma: Fix sleep from invalid context BUG 2022-07-29 17:25:10 +02:00
input Input: goodix - try not to touch the reset-pin on x86/ACPI devices 2022-07-12 16:34:51 +02:00
interconnect
iommu iommu/vt-d: Fix PCI bus rescan device hot add 2022-07-12 16:35:09 +02:00
ipack
irqchip irqchip/mips-gic: Check the return value of ioremap() in gic_of_init() 2022-08-17 14:23:01 +02:00
isdn
leds
macintosh macintosh/adb: fix oob read in do_adb_query() function 2022-08-11 13:07:54 +02:00
mailbox
mcb
md md-raid10: fix KASAN warning 2022-08-17 14:22:57 +02:00
media media: davinci: vpif: fix use-after-free on driver unbind 2022-07-12 16:34:57 +02:00
memory memory: renesas-rpc-if: Avoid unaligned bus access for HyperFlash 2022-07-12 16:34:52 +02:00
memstick
message
mfd
misc misc: rtsx_usb: set return value in rsp_buf alloc err path 2022-07-12 16:35:17 +02:00
mmc
most
mtd mtd: rawnand: arasan: Update NAND bus clock instead of system clock 2022-08-17 14:22:54 +02:00
mux
net usbnet: Fix linkwatch use-after-free on disconnect 2022-08-17 14:22:51 +02:00
nfc NFC: nxp-nci: don't print header length mismatch on i2c error 2022-07-21 21:24:35 +02:00
ntb
nubus
nvdimm
nvme nvme: fix block device naming collision 2022-07-29 17:25:12 +02:00
nvmem
of
opp
parisc parisc: Check the return value of ioremap() in lba_driver_probe() 2022-08-17 14:22:51 +02:00
parport
pci PCI: hv: Fix interrupt mapping for multi-MSI 2022-07-29 17:25:07 +02:00
pcmcia
perf
phy
pinctrl pinctrl: armada-37xx: use raw spinlocks for regmap to avoid invalid wait context 2022-07-29 17:25:20 +02:00
platform platform/x86: hp-wmi: Ignore Sanitization Mode event 2022-07-21 21:24:34 +02:00
pnp
power power/reset: arm-versatile: Fix refcount leak in versatile_reboot_probe 2022-07-29 17:25:10 +02:00
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc rtc: rx8025: fix 12/24 hour mode detection on RX-8035 2022-08-17 14:22:53 +02:00
s390 tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:25:32 +02:00
sbus
scsi scsi: qla2xxx: Zero undefined mailbox IN registers 2022-08-17 14:22:55 +02:00
sh
siox
slimbus
soc soc: ixp4xx/npe: Fix unused match warning 2022-07-21 21:24:40 +02:00
soundwire soundwire: qcom: Check device status before reading devid 2022-08-17 14:22:56 +02:00
spi spi: synquacer: Add missing clk_disable_unprepare() 2022-08-17 14:23:03 +02:00
spmi
ssb
staging media: [PATCH] pci: atomisp_cmd: fix three missing checks on list iterator 2022-08-17 14:22:57 +02:00
target
tc
tee
thermal thermal: sysfs: Fix cooling_device_stats_setup() error code path 2022-08-17 14:22:50 +02:00
thunderbolt
tty serial: mvebu-uart: uart2 error bits clearing 2022-08-17 14:22:56 +02:00
uio
usb usb: dwc3: gadget: fix high speed multiplier setting 2022-08-17 14:22:59 +02:00
vdpa vduse: Tie vduse mgmtdev and its device 2022-07-21 21:24:33 +02:00
vfio
vhost
video fbcon: Fix accelerated fbdev scrolling while logo is still shown 2022-08-17 14:22:51 +02:00
virt
virtio virtio_mmio: Restore guest page size on resume 2022-07-21 21:24:33 +02:00
visorbus
vlynq
vme
w1
watchdog
xen xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE 2022-07-21 21:24:23 +02:00
zorro
Kconfig
Makefile