* [PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window
@ 2017-02-01 3:26 Alexey Kardashevskiy
2017-02-01 3:39 ` David Gibson
2017-02-01 17:06 ` Alex Williamson
0 siblings, 2 replies; 3+ messages in thread
From: Alexey Kardashevskiy @ 2017-02-01 3:26 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Alex Williamson, David Gibson, kvm
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@ozlabs.ru>
---
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);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window
2017-02-01 3:26 [PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window Alexey Kardashevskiy
@ 2017-02-01 3:39 ` David Gibson
2017-02-01 17:06 ` Alex Williamson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-02-01 3:39 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: linuxppc-dev, Alex Williamson, kvm
[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]
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@ozlabs.ru>
Reviewed-by: David Gibson <david@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window
2017-02-01 3:26 [PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window Alexey Kardashevskiy
2017-02-01 3:39 ` David Gibson
@ 2017-02-01 17:06 ` Alex Williamson
1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2017-02-01 17:06 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: linuxppc-dev, David Gibson, kvm
On Wed, 1 Feb 2017 14:26:16 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> 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@ozlabs.ru>
> ---
> drivers/vfio/vfio_iommu_spapr_tce.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
Applies to for-linus branch for v4.10-rc7 w/ David's R-b. Thanks,
Alex
> 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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-01 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-01 3:26 [PATCH kernel] vfio/spapr: Fix missing mutex unlock when creating a window Alexey Kardashevskiy
2017-02-01 3:39 ` David Gibson
2017-02-01 17:06 ` Alex Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).