linux/drivers/base
Christophe JAILLET 49a5b1735c drivers/base/memory: fix an unlikely reference counting issue in __add_memory_block()
[ Upstream commit f47f758cff ]

__add_memory_block() calls both put_device() and device_unregister() when
storing the memory block into the xarray.  This is incorrect because
xarray doesn't take an additional reference and device_unregister()
already calls put_device().

Triggering the issue looks really unlikely and its only effect should be
to log a spurious warning about a ref counted issue.

Link: https://lkml.kernel.org/r/d44c63d78affe844f020dc02ad6af29abc448fc4.1650611702.git.christophe.jaillet@wanadoo.fr
Fixes: 4fb6eabf10 ("drivers/base/memory.c: cache memory blocks in xarray to accelerate lookup")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Scott Cheloha <cheloha@linux.vnet.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:21:16 +02:00
..
firmware_loader firmware_loader: use kernel credentials when reading firmware 2022-05-18 10:23:46 +02:00
power PM: core: keep irq flags in device_pm_check_callbacks() 2022-04-08 14:40:32 +02:00
regmap regmap-irq: Update interrupt clear register for proper reset 2022-03-02 11:42:52 +01:00
test drivers/base: build kunit tests without structleak plugin 2021-03-17 17:06:24 +01:00
arch_topology.c arch_topology: Do not set llc_sibling if llc_id is invalid 2022-05-09 09:04:59 +02:00
attribute_container.c
base.h
bus.c
cacheinfo.c
class.c
component.c
container.c
core.c PM: runtime: Add safety net to supplier device release 2022-01-27 10:54:17 +01:00
cpu.c
dd.c driver core: dd: fix return value of __setup handler 2022-04-08 14:40:28 +02:00
devcoredump.c
devres.c
devtmpfs.c devtmpfs regression fix: reconfigure on each mount 2022-01-20 09:17:49 +01:00
driver.c
firmware.c
hypervisor.c
init.c
isa.c
Kconfig
Makefile
map.c
memory.c drivers/base/memory: fix an unlikely reference counting issue in __add_memory_block() 2022-06-09 10:21:16 +02:00
module.c
node.c drivers/base/node.c: fix compaction sysfs file leak 2022-06-09 10:21:16 +02:00
pinctrl.c
platform-msi.c
platform.c
property.c device property: Fix fwnode_graph_devcon_match() fwnode leak 2022-01-27 10:54:25 +01:00
soc.c
swnode.c software node: fix wrong node passed to find nargs_prop 2022-01-27 10:53:59 +01:00
syscore.c
topology.c
transport_class.c