mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
powerpc/pci/rpadlpar: Fix device reference leaks
Make sure to drop any device reference taken by vio_find_node() when
adding and removing virtual I/O slots.
Fixes: 5eeb8c63a3
("[PATCH] PCI Hotplug: rpaphp: Move VIO registration")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
e8cfb7e7c3
commit
99e5cde5ea
@ -257,8 +257,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
|
||||
@ -334,6 +339,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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user