diff options
author | David Hildenbrand <david@redhat.com> | 2022-03-22 22:47:09 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-22 23:57:10 +0100 |
commit | 7ea0d2d79da09d1f7d71c96a9c9bc1b5229360b5 (patch) | |
tree | ab93ada0412ecf7e4f35416fccfc7df0d6b9d942 /arch/sh | |
parent | memcg: do not tweak node in alloc_mem_cgroup_per_node_info (diff) | |
download | linux-7ea0d2d79da09d1f7d71c96a9c9bc1b5229360b5.tar.xz linux-7ea0d2d79da09d1f7d71c96a9c9bc1b5229360b5.zip |
drivers/base/memory: add memory block to memory group after registration succeeded
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: 028fc57a1c36 ("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>
Diffstat (limited to 'arch/sh')
0 files changed, 0 insertions, 0 deletions