diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2017-02-01 06:26:16 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2017-02-01 19:48:34 +0300 |
commit | 2da64d20a0b20046d688e44f4033efd09157e29d (patch) | |
tree | 44d2bca16b1b26dd2d06254940ba213847bea7b4 /drivers/vfio/vfio_iommu_spapr_tce.c | |
parent | 566cf877a1fcb6d6dc0126b076aad062054c2637 (diff) | |
download | linux-2da64d20a0b20046d688e44f4033efd09157e29d.tar.xz |
vfio/spapr: Fix missing mutex unlock when creating a window
Commit d9c728949ddc ("vfio/spapr: Postpone default window creation")
added an additional exit to the VFIO_IOMMU_SPAPR_TCE_CREATE case and
made it possible to return from tce_iommu_ioctl() without unlocking
container->lock; this fixes the issue.
Fixes: d9c728949ddc ("vfio/spapr: Postpone default window creation")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/vfio_iommu_spapr_tce.c')
-rw-r--r-- | drivers/vfio/vfio_iommu_spapr_tce.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 128d10282d16..7690e5bf3cf1 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -1123,12 +1123,11 @@ static long tce_iommu_ioctl(void *iommu_data, mutex_lock(&container->lock); ret = tce_iommu_create_default_window(container); - if (ret) - return ret; - - ret = tce_iommu_create_window(container, create.page_shift, - create.window_size, create.levels, - &create.start_addr); + if (!ret) + ret = tce_iommu_create_window(container, + create.page_shift, + create.window_size, create.levels, + &create.start_addr); mutex_unlock(&container->lock); |