diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2016-12-30 08:13:33 -0700 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2016-12-30 08:13:33 -0700 |
commit | 49550787a90b5bfa44d8dc424d11824dbe21473d (patch) | |
tree | fa32ae34a162eab3b96c2f1740aa64af822b5e5f /samples/vfio-mdev/mtty.c | |
parent | 6c38c055cc4c0a5da31873d173b2de3085f43f33 (diff) | |
download | linux-49550787a90b5bfa44d8dc424d11824dbe21473d.tar.bz2 |
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 'samples/vfio-mdev/mtty.c')
0 files changed, 0 insertions, 0 deletions