diff options
author | Liam Ni <zhiguangni01@gmail.com> | 2022-06-25 19:42:39 +0800 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2022-06-30 10:57:58 -0600 |
commit | 1c61d51e9695d00535d28fc2e123ba9397378707 (patch) | |
tree | 47643739227337e14d008f1f83b73c770578bf9f | |
parent | d1877e639bc6bf1c3131eda3f9ede73f8da96c22 (diff) | |
download | linux-stable-1c61d51e9695d00535d28fc2e123ba9397378707.tar.gz linux-stable-1c61d51e9695d00535d28fc2e123ba9397378707.tar.bz2 linux-stable-1c61d51e9695d00535d28fc2e123ba9397378707.zip |
vfio: check iommu_group_set_name() return value
As iommu_group_set_name() can fail, we should check the return value.
Signed-off-by: Liam Ni <zhiguangni01@gmail.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20220625114239.9301-1-zhiguangni01@gmail.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r-- | drivers/vfio/vfio.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 61e71c1154be..ca823eeac237 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -504,7 +504,9 @@ static struct vfio_group *vfio_noiommu_group_alloc(struct device *dev, if (IS_ERR(iommu_group)) return ERR_CAST(iommu_group); - iommu_group_set_name(iommu_group, "vfio-noiommu"); + ret = iommu_group_set_name(iommu_group, "vfio-noiommu"); + if (ret) + goto out_put_group; ret = iommu_group_add_device(iommu_group, dev); if (ret) goto out_put_group; |