linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/etnaviv: fix missing unlock on error in etnaviv_iommuv1_context_alloc()
@ 2019-08-19  6:17 Wei Yongjun
  2019-09-02 10:50 ` Lucas Stach
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2019-08-19  6:17 UTC (permalink / raw)
  To: Lucas Stach, Russell King, Christian Gmeiner, David Airlie,
	Daniel Vetter
  Cc: Wei Yongjun, etnaviv, dri-devel, linux-kernel, kernel-janitors

Add the missing unlock before return from function etnaviv_iommuv1_context_alloc()
in the error handling case.

Fixes: 27b67278e007 ("drm/etnaviv: rework MMU handling")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_iommu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
index aac8dbf3ea56..1a7c89a67bea 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
@@ -140,8 +140,10 @@ etnaviv_iommuv1_context_alloc(struct etnaviv_iommu_global *global)
 	}
 
 	v1_context = kzalloc(sizeof(*v1_context), GFP_KERNEL);
-	if (!v1_context)
+	if (!v1_context) {
+		mutex_unlock(&global->lock);
 		return NULL;
+	}
 
 	v1_context->pgtable_cpu = dma_alloc_wc(global->dev, PT_SIZE,
 					       &v1_context->pgtable_dma,




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] drm/etnaviv: fix missing unlock on error in etnaviv_iommuv1_context_alloc()
  2019-08-19  6:17 [PATCH -next] drm/etnaviv: fix missing unlock on error in etnaviv_iommuv1_context_alloc() Wei Yongjun
@ 2019-09-02 10:50 ` Lucas Stach
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas Stach @ 2019-09-02 10:50 UTC (permalink / raw)
  To: Wei Yongjun, Russell King, Christian Gmeiner, David Airlie,
	Daniel Vetter
  Cc: etnaviv, dri-devel, linux-kernel, kernel-janitors

On Mo, 2019-08-19 at 06:17 +0000, Wei Yongjun wrote:
> Add the missing unlock before return from function
> etnaviv_iommuv1_context_alloc()
> in the error handling case.
> 
> Fixes: 27b67278e007 ("drm/etnaviv: rework MMU handling")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Thanks, applied.

For my education, can you tell me which tool you did use to catch this
issue?

Regards,
Lucas

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_iommu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> index aac8dbf3ea56..1a7c89a67bea 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> @@ -140,8 +140,10 @@ etnaviv_iommuv1_context_alloc(struct
> etnaviv_iommu_global *global)
>  	}
>  
>  	v1_context = kzalloc(sizeof(*v1_context), GFP_KERNEL);
> -	if (!v1_context)
> +	if (!v1_context) {
> +		mutex_unlock(&global->lock);
>  		return NULL;
> +	}
>  
>  	v1_context->pgtable_cpu = dma_alloc_wc(global->dev, PT_SIZE,
>  					       &v1_context-
> >pgtable_dma,
> 
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-02 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19  6:17 [PATCH -next] drm/etnaviv: fix missing unlock on error in etnaviv_iommuv1_context_alloc() Wei Yongjun
2019-09-02 10:50 ` Lucas Stach

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).