IB/usnic: Fix locking when unregistering

Move the call to usnic_ib_device_remove after usnic_ib_ibdev_list_lock has
been released.

Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Parvi Kaustubhi 2019-02-08 13:53:43 -08:00 committed by Jason Gunthorpe
parent c8a7eb554a
commit 0c23660649

View File

@ -470,15 +470,17 @@ static void usnic_ib_undiscover_pf(struct kref *kref)
&usnic_ib_ibdev_list, ib_dev_link) {
if (us_ibdev->pdev == dev) {
list_del(&us_ibdev->ib_dev_link);
usnic_ib_device_remove(us_ibdev);
found = true;
break;
}
}
WARN(!found, "Failed to remove PF %s\n", pci_name(dev));
mutex_unlock(&usnic_ib_ibdev_list_lock);
if (found)
usnic_ib_device_remove(us_ibdev);
else
WARN(1, "Failed to remove PF %s\n", pci_name(dev));
}
static struct usnic_ib_dev *usnic_ib_discover_pf(struct usnic_vnic *vnic)