提交 d256459f 编写于 作者: C Christophe JAILLET 提交者: Alex Williamson

vfio: Fix handling of error returned by 'vfio_group_get_from_dev()'

'vfio_group_get_from_dev()' seems to return only NULL on error, not an
error pointer.

Fixes: 2169037d ("vfio iommu: Added pin and unpin callback functions to vfio_iommu_driver_ops")
Fixes: c086de81 ("vfio iommu: Add blocking notifier to notify DMA_UNMAP")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
上级 5ba6de98
...@@ -1933,8 +1933,8 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage, ...@@ -1933,8 +1933,8 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage,
return -E2BIG; return -E2BIG;
group = vfio_group_get_from_dev(dev); group = vfio_group_get_from_dev(dev);
if (IS_ERR(group)) if (!group)
return PTR_ERR(group); return -ENODEV;
ret = vfio_group_add_container_user(group); ret = vfio_group_add_container_user(group);
if (ret) if (ret)
...@@ -1982,8 +1982,8 @@ int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn, int npage) ...@@ -1982,8 +1982,8 @@ int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn, int npage)
return -E2BIG; return -E2BIG;
group = vfio_group_get_from_dev(dev); group = vfio_group_get_from_dev(dev);
if (IS_ERR(group)) if (!group)
return PTR_ERR(group); return -ENODEV;
ret = vfio_group_add_container_user(group); ret = vfio_group_add_container_user(group);
if (ret) if (ret)
...@@ -2019,8 +2019,8 @@ int vfio_register_notifier(struct device *dev, struct notifier_block *nb) ...@@ -2019,8 +2019,8 @@ int vfio_register_notifier(struct device *dev, struct notifier_block *nb)
return -EINVAL; return -EINVAL;
group = vfio_group_get_from_dev(dev); group = vfio_group_get_from_dev(dev);
if (IS_ERR(group)) if (!group)
return PTR_ERR(group); return -ENODEV;
ret = vfio_group_add_container_user(group); ret = vfio_group_add_container_user(group);
if (ret) if (ret)
...@@ -2055,8 +2055,8 @@ int vfio_unregister_notifier(struct device *dev, struct notifier_block *nb) ...@@ -2055,8 +2055,8 @@ int vfio_unregister_notifier(struct device *dev, struct notifier_block *nb)
return -EINVAL; return -EINVAL;
group = vfio_group_get_from_dev(dev); group = vfio_group_get_from_dev(dev);
if (IS_ERR(group)) if (!group)
return PTR_ERR(group); return -ENODEV;
ret = vfio_group_add_container_user(group); ret = vfio_group_add_container_user(group);
if (ret) if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册