]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc/sysfs: Fix reference leak of cpu device_nodes present at boot
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Tue, 18 Apr 2017 00:24:39 +0000 (20:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 13:46:22 +0000 (15:46 +0200)
commiteb0807b288ac5b75d80553148616160ebb4cb51f
treed733136d43db0ddbfd95c9768b1cf07b52ec583b
parentd731227327be584369ec370f5527a8d0fea7a792
powerpc/sysfs: Fix reference leak of cpu device_nodes present at boot

commit e76ca27790a514590af782f83f6eae49e0ccf8c9 upstream.

For CPUs present at boot each logical CPU acquires a reference to the
associated device node of the core. This happens in register_cpu() which
is called by topology_init(). The result of this is that we end up with
a reference held by each thread of the core. However, these references
are never freed if the CPU core is DLPAR removed.

This patch fixes the reference leaks by acquiring and releasing the references
in the CPU hotplug callbacks un/register_cpu_online(). With this patch symmetric
reference counting is observed with both CPUs present at boot, and those DLPAR
added after boot.

Fixes: f86e4718f24b ("driver/core: cpu: initialize of_node in cpu's device struture")
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/sysfs.c