2022-04-18 12:27:15

by Saud Farooqui

[permalink] [raw]
Subject: [PATCH] iommufd: unlock ictx->vfio_compat before return.

cocci warning: drivers/iommu/iommufd/vfio_compat.c:494:2-8: preceding
lock on line 491

Reported-by: kernel test robot <[email protected]>
Reported-by: Julia Lawall <[email protected]>
Signed-off-by: Saud Farooqui <[email protected]>
---
drivers/iommu/iommufd/vfio_compat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/vfio_compat.c b/drivers/iommu/iommufd/vfio_compat.c
index 5b196de00ff9..d9347df48cc8 100644
--- a/drivers/iommu/iommufd/vfio_compat.c
+++ b/drivers/iommu/iommufd/vfio_compat.c
@@ -491,8 +491,10 @@ void vfio_group_unset_iommufd(void *iommufd, struct list_head *device_list)
return;
mutex_lock(&ictx->vfio_compat);
ioas = get_compat_ioas(ictx);
- if (IS_ERR(ioas))
+ if (IS_ERR(ioas)) {
+ mutex_unlock(&ictx->vfio_compat);
return;
+ }

ioas_id = ioas->obj.id;
iommufd_put_object(&ioas->obj);
--
2.25.1