Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c236606 authored by Parvi Kaustubhi's avatar Parvi Kaustubhi Committed by Jason Gunthorpe
Browse files

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: default avatarParvi Kaustubhi <pkaustub@cisco.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent c8a7eb55
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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)