forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An element is added to the group->unbound_list only during vfio_unregister_group_dev(). In turn this is only ever called from a driver core device_driver remove() function. The element stays on the unbound_list until a IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER is delivered which removes the list element. However IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER is really just the driver core bus callback BUS_NOTIFY_UNBOUND_DRIVER. BUS_NOTIFY_UNBOUND_DRIVER is generated in one place by the driver core under the device_lock(): static void __device_release_driver(struct device *dev, struct device *parent) { [..] else if (drv->remove) drv->remove(dev); blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_UNBOUND_DRIVER, dev); There is only one place that reads the unbound_list - vfio_dev_viable(): device_lock_assert(dev); list_for_each_entry(unbound, &group->unbound_list, unbound_next) { if (dev == unbound->dev) { In short, we obtain the device_lock(), add then immediately remove the unbound item. The only reader is done under the device_lock() and can thus never see the item we added. Delete the whole thing. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
- Loading branch information
1 parent
fa6abb3
commit 45980bd
Showing
1 changed file
with
2 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters