Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1371622 > unrolled thread

[PATCH 2/2] drm/rockchip: don't leak iommu mapping

Started byJohn Keeping <john@metanate.com>
First post2016-04-05 16:00 +0200
Last post2016-04-11 05:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] drm/rockchip: don't leak iommu mapping John Keeping <john@metanate.com> - 2016-04-05 16:00 +0200
    Re: [PATCH 2/2] drm/rockchip: don't leak iommu mapping Mark yao <mark.yao@rock-chips.com> - 2016-04-11 05:00 +0200

#1371622 — [PATCH 2/2] drm/rockchip: don't leak iommu mapping

FromJohn Keeping <john@metanate.com>
Date2016-04-05 16:00 +0200
Subject[PATCH 2/2] drm/rockchip: don't leak iommu mapping
Message-ID<rkzGr-4wA-19@gated-at.bofh.it>
arm_iommu_attach_device() takes its own reference to the mapping we give
it.  Since we do not keep a reference to the mapping ourselves, we must
release it before returning.

Also fix the error path, which fails to release the mapping if it has
called arm_iommu_detach_device() since that clears archdata.mapping.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 7695c79..1e2d88b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -218,6 +218,7 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
 	if (ret)
 		goto err_vblank_cleanup;
 
+	arm_iommu_release_mapping(mapping);
 	return 0;
 err_vblank_cleanup:
 	drm_vblank_cleanup(drm_dev);
@@ -228,7 +229,7 @@ err_unbind:
 err_detach_device:
 	arm_iommu_detach_device(dev);
 err_release_mapping:
-	arm_iommu_release_mapping(dev->archdata.mapping);
+	arm_iommu_release_mapping(mapping);
 err_config_cleanup:
 	drm_mode_config_cleanup(drm_dev);
 	drm_dev->dev_private = NULL;
-- 
2.8.0.rc4.238.g874082a

[toc] | [next] | [standalone]


#1375434

FromMark yao <mark.yao@rock-chips.com>
Date2016-04-11 05:00 +0200
Message-ID<rmAeZ-75P-1@gated-at.bofh.it>
In reply to#1371622
On 2016年04月05日 21:50, John Keeping wrote:
> arm_iommu_attach_device() takes its own reference to the mapping we give
> it.  Since we do not keep a reference to the mapping ourselves, we must
> release it before returning.
>
> Also fix the error path, which fails to release the mapping if it has
> called arm_iommu_detach_device() since that clears archdata.mapping.
>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 7695c79..1e2d88b 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -218,6 +218,7 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
>   	if (ret)
>   		goto err_vblank_cleanup;
>   
> +	arm_iommu_release_mapping(mapping);
>   	return 0;
>   err_vblank_cleanup:
>   	drm_vblank_cleanup(drm_dev);
> @@ -228,7 +229,7 @@ err_unbind:
>   err_detach_device:
>   	arm_iommu_detach_device(dev);
>   err_release_mapping:
> -	arm_iommu_release_mapping(dev->archdata.mapping);
> +	arm_iommu_release_mapping(mapping);
>   err_config_cleanup:
>   	drm_mode_config_cleanup(drm_dev);
>   	drm_dev->dev_private = NULL;
Applied to my drm-fixes

Thanks.

-- 
Mark Yao

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web