linux-stable/drivers/base
Greg Kroah-Hartman ddaf098ea7 driver core: class: properly reference count class_dev_iter()
When class_dev_iter is initialized, the reference count for the subsys
private structure is incremented, but never decremented, causing a
memory leak over time.  To resolve this, save off a pointer to the
internal structure into the class_dev_iter structure and then when the
iterator is finished, drop the reference count.

Reported-and-tested-by: syzbot+e7afd76ad060fa0d2605@syzkaller.appspotmail.com
Fixes: 7b884b7f24 ("driver core: class.c: convert to only use class_to_subsys")
Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Cc: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Link: https://lore.kernel.org/r/2023051610-stove-condense-9a77@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-19 11:03:36 +01:00
..
firmware_loader firmware_loader: rework crypto dependencies 2023-04-20 11:42:31 +02:00
power Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
regmap - Nick Piggin's "shoot lazy tlbs" series, to improve the peformance of 2023-04-27 19:42:02 -07:00
test
arch_numa.c
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: class: make class_register() take a const * 2023-04-03 21:42:46 +02:00
bus.c
cacheinfo.c Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
class.c driver core: class: properly reference count class_dev_iter() 2023-05-19 11:03:36 +01:00
component.c
container.c
core.c driver core: update comments in device_rename() 2023-04-20 14:19:25 +02:00
cpu.c tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem 2023-04-05 13:47:43 +00:00
dd.c driver core: Don't require dynamic_debug for initcall_debug probe timing 2023-04-20 14:17:47 +02:00
devcoredump.c driver core: class: mark the struct class for sysfs callbacks as constant 2023-03-29 07:54:58 +02:00
devres.c
devtmpfs.c driver core: clean up the logic to determine which /sys/dev/ directory to use 2023-03-31 17:45:07 +02:00
driver.c
firmware.c
hypervisor.c
init.c
isa.c
Kconfig driver core: Add CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT 2023-03-28 18:45:59 +02:00
Makefile
map.c
memory.c
module.c
node.c
physical_location.c
physical_location.h
pinctrl.c
platform-msi.c
platform.c
property.c device property: make device_property functions take const device * 2023-04-20 14:25:07 +02:00
soc.c base: soc: populate machine name in soc_device_register if empty 2023-03-29 12:21:23 +02:00
swnode.c
syscore.c
topology.c
trace.c
trace.h
transport_class.c