diff mbox series

[v5,01/17] drm/panfrost: Put mapping instead of shmem obj on panfrost_mmu_map_fault_addr() error

Message ID 20220424190424.540501-2-dmitry.osipenko@collabora.com (mailing list archive)
State New, archived
Headers show
Series Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers | expand

Commit Message

Dmitry Osipenko April 24, 2022, 7:04 p.m. UTC
When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be
unreferenced and not the shmem object that backs that mapping.

Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Price April 28, 2022, 1:19 p.m. UTC | #1
On 24/04/2022 20:04, Dmitry Osipenko wrote:
> When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be
> unreferenced and not the shmem object that backs that mapping.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

Fixes: bdefca2d8dc0 ("drm/panfrost: Add the panfrost_gem_mapping concept")

Reviewed-by: Steven Price <steven.price@arm.com>

Thanks,

Steve

> ---
>  drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> index d3f82b26a631..b285a8001b1d 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> @@ -518,7 +518,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
>  err_pages:
>  	drm_gem_shmem_put_pages(&bo->base);
>  err_bo:
> -	drm_gem_object_put(&bo->base.base);
> +	panfrost_gem_mapping_put(bomapping);
>  	return ret;
>  }
>
Dmitry Osipenko April 28, 2022, 6:41 p.m. UTC | #2
28.04.2022 16:19, Steven Price пишет:
> On 24/04/2022 20:04, Dmitry Osipenko wrote:
>> When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be
>> unreferenced and not the shmem object that backs that mapping.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> 
> Fixes: bdefca2d8dc0 ("drm/panfrost: Add the panfrost_gem_mapping concept")
> 
> Reviewed-by: Steven Price <steven.price@arm.com>

Thank you for the fixes tag. It appeared to me that this problem existed
since the first addition of the srinker when I was looking up the
offending commit, my bad :)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index d3f82b26a631..b285a8001b1d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -518,7 +518,7 @@  static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
 err_pages:
 	drm_gem_shmem_put_pages(&bo->base);
 err_bo:
-	drm_gem_object_put(&bo->base.base);
+	panfrost_gem_mapping_put(bomapping);
 	return ret;
 }