WSL2-Linux-Kernel/drivers/base
David Hildenbrand 9ca7b59e78 drivers/base/memory: add memory block to memory group after registration succeeded
[ Upstream commit 7ea0d2d79d ]

If register_memory() fails, we freed the memory block but already added
the memory block to the group list, not good.  Let's defer adding the
block to the memory group to after registering the memory block device.

We do handle it properly during unregister_memory(), but that's not
called when the registration fails.

Link: https://lkml.kernel.org/r/20220128144540.153902-1-david@redhat.com
Fixes: 028fc57a1c ("drivers/base/memory: introduce "memory groups" to logically group memory blocks")
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:12 +02:00
..
firmware_loader firmware_loader: fix pre-allocated buf built-in firmware use 2021-11-25 09:48:27 +01:00
power PM: domains: Fix sleep-in-atomic bug caused by genpd_debug_remove() 2022-04-08 14:23:02 +02:00
regmap regmap-irq: Update interrupt clear register for proper reset 2022-03-02 11:48:01 +01:00
test
Kconfig
Makefile
arch_numa.c
arch_topology.c
attribute_container.c
auxiliary.c
base.h
bus.c
cacheinfo.c
class.c
component.c component: do not leave master devres group open after bind 2021-11-18 19:16:08 +01:00
container.c
core.c PM: runtime: Add safety net to supplier device release 2022-01-27 11:04:44 +01:00
cpu.c
dd.c driver core: Free DMA range map when device is released 2022-03-02 11:48:07 +01:00
devcoredump.c
devres.c
devtmpfs.c devtmpfs regression fix: reconfigure on each mount 2022-01-20 09:13:13 +01:00
driver.c
firmware.c
hypervisor.c
init.c
isa.c
map.c
memory.c drivers/base/memory: add memory block to memory group after registration succeeded 2022-04-08 14:23:12 +02:00
module.c
node.c
pinctrl.c
platform-msi.c
platform.c
property.c device property: Fix fwnode_graph_devcon_match() fwnode leak 2022-01-27 11:05:10 +01:00
soc.c
swnode.c software node: fix wrong node passed to find nargs_prop 2022-01-27 11:03:46 +01:00
syscore.c
topology.c
trace.c
trace.h
transport_class.c