twx-linux/drivers/base
Dmitry Torokhov abe56be73e driver core: fix potential NULL pointer dereference in dev_uevent()
commit 18daa52418e7e4629ed1703b64777294209d2622 upstream.

If userspace reads "uevent" device attribute at the same time as another
threads unbinds the device from its driver, change to dev->driver from a
valid pointer to NULL may result in crash. Fix this by using READ_ONCE()
when fetching the pointer, and take bus' drivers klist lock to make sure
driver instance will not disappear while we access it.

Use WRITE_ONCE() when setting the driver pointer to ensure there is no
tearing.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20250311052417.1846985-3-dmitry.torokhov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-02 07:51:03 +02:00
..
firmware_loader firmware_loader: Fix possible resource leak in fw_log_firmware_info() 2024-12-09 10:32:37 +01:00
power PM: sleep: Fix handling devices with direct_complete set on errors 2025-04-10 14:37:26 +02:00
regmap regmap-irq: Add missing kfree() 2025-02-21 13:57:19 +01:00
test drivers: base: test: Add missing MODULE_* macros to root device tests 2023-08-16 19:01:29 +02:00
arch_numa.c arm64: irq: set the correct node for VMAP stack 2024-02-05 20:14:14 +00:00
arch_topology.c arch_topology: Remove early cacheinfo error message if -ENOENT 2023-04-14 10:13:38 +01:00
attribute_container.c
auxiliary.c
base.h driver core: fix potential NULL pointer dereference in dev_uevent() 2025-05-02 07:51:03 +02:00
bus.c driver core: fix potential NULL pointer dereference in dev_uevent() 2025-05-02 07:51:03 +02:00
cacheinfo.c cacheinfo: Allocate memory during CPU hotplug if not done from the primary CPU 2024-12-14 19:59:55 +01:00
class.c driver core: class: Fix wild pointer dereferences in API class_dev_iter_next() 2025-02-08 09:52:27 +01:00
component.c
container.c
core.c driver core: fix potential NULL pointer dereference in dev_uevent() 2025-05-02 07:51:03 +02:00
cpu.c x86/rfds: Mitigate Register File Data Sampling (RFDS) 2024-03-15 10:48:22 -04:00
dd.c driver core: introduce device_set_driver() helper 2025-05-02 07:51:03 +02:00
devcoredump.c devcoredump: Send uevent once devcd is ready 2023-12-13 18:45:33 +01:00
devres.c drivers: base: devres: Allow to release group on device release 2025-04-25 10:45:18 +02:00
devtmpfs.c
driver.c
firmware.c
hypervisor.c
init.c
isa.c isa: Remove unnecessary checks 2023-05-31 19:03:39 +01:00
Kconfig
Makefile
map.c
memory.c mm/memory_hotplug: add missing mem_hotplug_lock 2023-12-13 18:45:24 +01:00
module.c Revert "driver core: Fix uevent_show() vs driver detach race" 2024-11-08 16:28:23 +01:00
node.c base/node.c: initialize the accessor list before registering 2024-01-25 15:35:51 -08:00
physical_location.c
physical_location.h
pinctrl.c
platform-msi.c
platform.c of: Move of_platform_register_reconfig_notifier() into DT core 2023-08-04 11:36:33 -06:00
property.c drivers: fwnode: fix fwnode_irq_get[_byname]() 2023-06-15 13:37:35 +02:00
soc.c
swnode.c software node: Let args be NULL in software_node_get_reference_args 2024-01-25 15:35:51 -08:00
syscore.c
topology.c topology: Keep the cpumask unchanged when printing cpumap 2025-01-17 13:36:20 +01:00
trace.c
trace.h
transport_class.c