2019-08-14 04:45:02

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] drm/panfrost: Fix missing unlock on error in panfrost_mmu_map_fault_addr()

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

Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations")
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 2ed411f09d80..06f1a563e940 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -327,14 +327,17 @@ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)
if (!bo->base.pages) {
bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M,
sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO);
- if (!bo->sgts)
+ if (!bo->sgts) {
+ mutex_unlock(&bo->base.pages_lock);
return -ENOMEM;
+ }

pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT,
sizeof(struct page *), GFP_KERNEL | __GFP_ZERO);
if (!pages) {
kfree(bo->sgts);
bo->sgts = NULL;
+ mutex_unlock(&bo->base.pages_lock);
return -ENOMEM;
}
bo->base.pages = pages;




2019-08-16 08:33:39

by Steven Price

[permalink] [raw]
Subject: Re: [PATCH -next] drm/panfrost: Fix missing unlock on error in panfrost_mmu_map_fault_addr()

On 14/08/2019 05:48, Wei Yongjun wrote:
> Add the missing unlock before return from function panfrost_mmu_map_fault_addr()
> in the error handling case.
>
> Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations")
> Signed-off-by: Wei Yongjun <[email protected]>

Well spotted.

Reviewed-by: Steven Price <[email protected]>

Steve

> ---
> drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> index 2ed411f09d80..06f1a563e940 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> @@ -327,14 +327,17 @@ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)
> if (!bo->base.pages) {
> bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M,
> sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO);
> - if (!bo->sgts)
> + if (!bo->sgts) {
> + mutex_unlock(&bo->base.pages_lock);
> return -ENOMEM;
> + }
>
> pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT,
> sizeof(struct page *), GFP_KERNEL | __GFP_ZERO);
> if (!pages) {
> kfree(bo->sgts);
> bo->sgts = NULL;
> + mutex_unlock(&bo->base.pages_lock);
> return -ENOMEM;
> }
> bo->base.pages = pages;
>
>
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

2019-08-19 16:58:14

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH -next] drm/panfrost: Fix missing unlock on error in panfrost_mmu_map_fault_addr()

On Tue, Aug 13, 2019 at 11:44 PM Wei Yongjun <[email protected]> wrote:
>
> Add the missing unlock before return from function panfrost_mmu_map_fault_addr()
> in the error handling case.
>
> Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations")
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

Applied, thanks.

Rob