summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2012-12-07 13:43:50 -0700
committerAlex Williamson <alex.williamson@redhat.com>2012-12-07 13:43:50 -0700
commitde2b3eeafb555d7b623c9f34e399b39105ca527f (patch)
tree4f744043daec519931283d7f9060fc5e8dd47756
parent9df7b25ab71cee770826d1e7983eb8b6715543d6 (diff)
downloadblackbird-op-linux-de2b3eeafb555d7b623c9f34e399b39105ca527f.tar.gz
blackbird-op-linux-de2b3eeafb555d7b623c9f34e399b39105ca527f.zip
VFIO: use ACCESS_ONCE() to guard access to dev->driver
Comments from dev_driver_string(), /* dev->driver can change to NULL underneath us because of unbinding, * so be careful about accessing it. */ So use ACCESS_ONCE() to guard access to dev->driver field. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--drivers/vfio/vfio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 3b7fa7967221..12c264d3b058 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -465,8 +465,9 @@ static int vfio_dev_viable(struct device *dev, void *data)
{
struct vfio_group *group = data;
struct vfio_device *device;
+ struct device_driver *drv = ACCESS_ONCE(dev->driver);
- if (!dev->driver || vfio_whitelisted_driver(dev->driver))
+ if (!drv || vfio_whitelisted_driver(drv))
return 0;
device = vfio_group_get_device(group, dev);
OpenPOWER on IntegriCloud