summaryrefslogtreecommitdiff
path: root/drivers/uio
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2016-12-30 08:13:33 -0700
committerAlex Williamson <alex.williamson@redhat.com>2016-12-30 08:13:33 -0700
commit49550787a90b5bfa44d8dc424d11824dbe21473d (patch)
treefa32ae34a162eab3b96c2f1740aa64af822b5e5f /drivers/uio
parent6c38c055cc4c0a5da31873d173b2de3085f43f33 (diff)
vfio-mdev: Fix remove race
Using the mtty mdev sample driver we can generate a remove race by starting one shell that continuously creates mtty devices and several other shells all attempting to remove devices, in my case four remove shells. The fault occurs in mdev_remove_sysfs_files() where the passed type arg is NULL, which suggests we've received a struct device in mdev_device_remove() but it's in some sort of teardown state. The solution here is to make use of the accidentally unused list_head on the mdev_device such that the mdev core keeps a list of all the mdev devices. This allows us to validate that we have a valid mdev before we start removal, remove it from the list to prevent others from working on it, and if the vendor driver refuses to remove, we can re-add it to the list. Cc: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/uio')
0 files changed, 0 insertions, 0 deletions