[PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window

David Gibson david at gibson.dropbear.id.au
Wed Feb 1 14:39:59 AEDT 2017


On Wed, Feb 01, 2017 at 02:26:16PM +1100, Alexey Kardashevskiy wrote:
> 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
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>

Reviewed-by: David Gibson <david at gibson.dropbear.id.au>

> ---
>  drivers/vfio/vfio_iommu_spapr_tce.c | 11 +++++------
>  1 file 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);
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20170201/8cd4b1d9/attachment.sig>


More information about the Linuxppc-dev mailing list