Skip to content

Commit

Permalink
driver/base/node: remove unnecessary kfree of node struct from unregi…
Browse files Browse the repository at this point in the history
…ster_one_node

Commit 92d585e ("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: Yasuaki Ishimatsu <[email protected]>
Cc: Xishi Qiu <[email protected]>
Cc: [email protected] # v3.16+
Fixes: 92d585e "numa: fix NULL pointer access and memory leak in unregister_one_node()"
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Yasuaki Ishimatsu authored and gregkh committed Oct 3, 2014
1 parent bef59c5 commit 33ead53
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/base/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ void unregister_one_node(int nid)
return;

unregister_node(node_devices[nid]);
kfree(node_devices[nid]);
node_devices[nid] = NULL;
}

Expand Down

0 comments on commit 33ead53

Please sign in to comment.