Skip to content

Commit 6b17ca8

Browse files
Wan Jiabingawilliam
authored andcommitted
kvm/vfio: Fix potential deadlock problem in vfio
Fix following coccicheck warning: ./virt/kvm/vfio.c:258:1-7: preceding lock on line 236 If kvm_vfio_file_iommu_group() failed, code would goto err_fdput with mutex_lock acquired and then return ret. It might cause potential deadlock. Move mutex_unlock bellow err_fdput tag to fix it. Fixes: d55d9e7 ("kvm/vfio: Store the struct file in the kvm_vfio_group") Signed-off-by: Wan Jiabing <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent 1c05bb9 commit 6b17ca8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

virt/kvm/vfio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ static int kvm_vfio_group_set_spapr_tce(struct kvm_device *dev,
252252
break;
253253
}
254254

255-
mutex_unlock(&kv->lock);
256255
err_fdput:
256+
mutex_unlock(&kv->lock);
257257
fdput(f);
258258
return ret;
259259
}

0 commit comments

Comments
 (0)