]> git.baikalelectronics.ru Git - kernel.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)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 24 Apr 2017 14:24:59 +0000 (00:24 +1000)
commit99b09f65b9adc9ef2ef7d37f0b25c8ec87abe065
tree5ae924ca46720ffad8feba6ac797e0beeef46236
parent5c593fbd42f4ee17213cc0d0bb591c3bc962dc4c
powerpc/sysfs: Fix reference leak of cpu device_nodes present at boot

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: 03dee0d95bd0 ("driver/core: cpu: initialize of_node in cpu's device struture")
Cc: stable@vger.kernel.org # v3.12+
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/sysfs.c