Commit 8f251525 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

powerpc/pci/rpadlpar: Fix device reference leaks

commit 99e5cde5 upstream.

Make sure to drop any device reference taken by vio_find_node() when
adding and removing virtual I/O slots.

Fixes: 5eeb8c63 ("[PATCH] PCI Hotplug: rpaphp: Move VIO registration")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ccd7bd29
......@@ -258,8 +258,13 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn)
static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn)
{
if (vio_find_node(dn))
struct vio_dev *vio_dev;
vio_dev = vio_find_node(dn);
if (vio_dev) {
put_device(&vio_dev->dev);
return -EINVAL;
}
if (!vio_register_device_node(dn)) {
printk(KERN_ERR
......@@ -335,6 +340,9 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn)
return -EINVAL;
vio_unregister_device(vio_dev);
put_device(&vio_dev->dev);
return 0;
}
......
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