提交 de2b3eea 编写于 作者: J Jiang Liu 提交者: Alex Williamson

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: NJiang Liu <jiang.liu@huawei.com>
Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
上级 9df7b25a
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册