Commit ceb0e516 authored by Yasuaki Ishimatsu's avatar Yasuaki Ishimatsu Committed by Greg Kroah-Hartman

driver/base/node: remove unnecessary kfree of node struct from unregister_one_node

commit 33ead538 upstream.

Commit 92d585ef ("numa: fix NULL pointer access and memory
leak in unregister_one_node()") added kfree() of node struct in
unregister_one_node(). But node struct is freed by node_device_release()
which is called in  unregister_node(). So by adding the kfree(),
node struct is freed two times.

While hot removing memory, the commit leads the following BUG_ON():

  kernel BUG at mm/slub.c:3346!
  invalid opcode: 0000 [#1] SMP
  [...]
  Call Trace:
   [...] unregister_one_node
   [...] try_offline_node
   [...] remove_memory
   [...] acpi_memory_device_remove
   [...] acpi_bus_trim
   [...] acpi_bus_trim
   [...] acpi_device_hotplug
   [...] acpi_hotplug_work_fn
   [...] process_one_work
   [...] worker_thread
   [...] ? rescuer_thread
   [...] kthread
   [...] ? kthread_create_on_node
   [...] ret_from_fork
   [...] ? kthread_create_on_node

This patch removes unnecessary kfree() from unregister_one_node().
Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Fixes: 92d585ef "numa: fix NULL pointer access and memory leak in unregister_one_node()"
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 776c2868
...@@ -603,7 +603,6 @@ void unregister_one_node(int nid) ...@@ -603,7 +603,6 @@ void unregister_one_node(int nid)
return; return;
unregister_node(node_devices[nid]); unregister_node(node_devices[nid]);
kfree(node_devices[nid]);
node_devices[nid] = NULL; node_devices[nid] = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment