All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06  9:14 ` Pan Bian
  0 siblings, 0 replies; 9+ messages in thread
From: Pan Bian @ 2019-11-06  9:14 UTC (permalink / raw)
  To: Alex Deucher, christian.koenig, David (ChunMing) Zhou,
	David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: amd-gfx, dri-devel, linux-kernel, Pan Bian

The object fence is not set to NULL after its reference is dropped. As a
result, its reference may be dropped again if error occurs after that,
which may lead to a use after free bug. To avoid the issue, fence is
explicitly set to NULL after dropping its reference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index b66d29d5ffa2..b158230af8db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		}
 
 		dma_fence_put(fence);
+		fence = NULL;
 
 		r = amdgpu_bo_kmap(vram_obj, &vram_map);
 		if (r) {
@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		}
 
 		dma_fence_put(fence);
+		fence = NULL;
 
 		r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
 		if (r) {
-- 
2.7.4


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

* [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06  9:14 ` Pan Bian
  0 siblings, 0 replies; 9+ messages in thread
From: Pan Bian @ 2019-11-06  9:14 UTC (permalink / raw)
  To: Alex Deucher, christian.koenig, David (ChunMing) Zhou,
	David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: Pan Bian, dri-devel, amd-gfx, linux-kernel

The object fence is not set to NULL after its reference is dropped. As a
result, its reference may be dropped again if error occurs after that,
which may lead to a use after free bug. To avoid the issue, fence is
explicitly set to NULL after dropping its reference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index b66d29d5ffa2..b158230af8db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		}
 
 		dma_fence_put(fence);
+		fence = NULL;
 
 		r = amdgpu_bo_kmap(vram_obj, &vram_map);
 		if (r) {
@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		}
 
 		dma_fence_put(fence);
+		fence = NULL;
 
 		r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
 		if (r) {
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06  9:14 ` Pan Bian
  0 siblings, 0 replies; 9+ messages in thread
From: Pan Bian @ 2019-11-06  9:14 UTC (permalink / raw)
  To: Alex Deucher, christian.koenig, David (ChunMing) Zhou,
	David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: Pan Bian, dri-devel, amd-gfx, linux-kernel

The object fence is not set to NULL after its reference is dropped. As a
result, its reference may be dropped again if error occurs after that,
which may lead to a use after free bug. To avoid the issue, fence is
explicitly set to NULL after dropping its reference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index b66d29d5ffa2..b158230af8db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		}
 
 		dma_fence_put(fence);
+		fence = NULL;
 
 		r = amdgpu_bo_kmap(vram_obj, &vram_map);
 		if (r) {
@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		}
 
 		dma_fence_put(fence);
+		fence = NULL;
 
 		r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
 		if (r) {
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06  9:38   ` Koenig, Christian
  0 siblings, 0 replies; 9+ messages in thread
From: Koenig, Christian @ 2019-11-06  9:38 UTC (permalink / raw)
  To: Pan Bian, Deucher, Alexander, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: amd-gfx, dri-devel, linux-kernel

Am 06.11.19 um 10:14 schrieb Pan Bian:
> The object fence is not set to NULL after its reference is dropped. As a
> result, its reference may be dropped again if error occurs after that,
> which may lead to a use after free bug. To avoid the issue, fence is
> explicitly set to NULL after dropping its reference.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> index b66d29d5ffa2..b158230af8db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> @@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
>   		}
>   
>   		dma_fence_put(fence);
> +		fence = NULL;
>   
>   		r = amdgpu_bo_kmap(vram_obj, &vram_map);
>   		if (r) {
> @@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
>   		}
>   
>   		dma_fence_put(fence);
> +		fence = NULL;
>   
>   		r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
>   		if (r) {


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

* Re: [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06  9:38   ` Koenig, Christian
  0 siblings, 0 replies; 9+ messages in thread
From: Koenig, Christian @ 2019-11-06  9:38 UTC (permalink / raw)
  To: Pan Bian, Deucher, Alexander, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: dri-devel, amd-gfx, linux-kernel

Am 06.11.19 um 10:14 schrieb Pan Bian:
> The object fence is not set to NULL after its reference is dropped. As a
> result, its reference may be dropped again if error occurs after that,
> which may lead to a use after free bug. To avoid the issue, fence is
> explicitly set to NULL after dropping its reference.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> index b66d29d5ffa2..b158230af8db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> @@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
>   		}
>   
>   		dma_fence_put(fence);
> +		fence = NULL;
>   
>   		r = amdgpu_bo_kmap(vram_obj, &vram_map);
>   		if (r) {
> @@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
>   		}
>   
>   		dma_fence_put(fence);
> +		fence = NULL;
>   
>   		r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
>   		if (r) {

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06  9:38   ` Koenig, Christian
  0 siblings, 0 replies; 9+ messages in thread
From: Koenig, Christian @ 2019-11-06  9:38 UTC (permalink / raw)
  To: Pan Bian, Deucher, Alexander, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: dri-devel, amd-gfx, linux-kernel

Am 06.11.19 um 10:14 schrieb Pan Bian:
> The object fence is not set to NULL after its reference is dropped. As a
> result, its reference may be dropped again if error occurs after that,
> which may lead to a use after free bug. To avoid the issue, fence is
> explicitly set to NULL after dropping its reference.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> index b66d29d5ffa2..b158230af8db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> @@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
>   		}
>   
>   		dma_fence_put(fence);
> +		fence = NULL;
>   
>   		r = amdgpu_bo_kmap(vram_obj, &vram_map);
>   		if (r) {
> @@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
>   		}
>   
>   		dma_fence_put(fence);
> +		fence = NULL;
>   
>   		r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
>   		if (r) {

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: fix potential double drop fence reference
  2019-11-06  9:38   ` Koenig, Christian
  (?)
@ 2019-11-06 17:19     ` Alex Deucher
  -1 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2019-11-06 17:19 UTC (permalink / raw)
  To: Koenig, Christian
  Cc: Pan Bian, Deucher, Alexander, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, Sam Ravnborg, dri-devel, amd-gfx,
	linux-kernel

On Wed, Nov 6, 2019 at 4:39 AM Koenig, Christian
<Christian.Koenig@amd.com> wrote:
>
> Am 06.11.19 um 10:14 schrieb Pan Bian:
> > The object fence is not set to NULL after its reference is dropped. As a
> > result, its reference may be dropped again if error occurs after that,
> > which may lead to a use after free bug. To avoid the issue, fence is
> > explicitly set to NULL after dropping its reference.
> >
> > Signed-off-by: Pan Bian <bianpan2016@163.com>
>
> Acked-by: Christian König <christian.koenig@amd.com>

Applied.  thanks!

Alex

>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > index b66d29d5ffa2..b158230af8db 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > @@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
> >               }
> >
> >               dma_fence_put(fence);
> > +             fence = NULL;
> >
> >               r = amdgpu_bo_kmap(vram_obj, &vram_map);
> >               if (r) {
> > @@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
> >               }
> >
> >               dma_fence_put(fence);
> > +             fence = NULL;
> >
> >               r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
> >               if (r) {
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06 17:19     ` Alex Deucher
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2019-11-06 17:19 UTC (permalink / raw)
  To: Koenig, Christian
  Cc: David Airlie, Pan Bian, linux-kernel, dri-devel, amd-gfx,
	Deucher, Alexander, Sam Ravnborg

On Wed, Nov 6, 2019 at 4:39 AM Koenig, Christian
<Christian.Koenig@amd.com> wrote:
>
> Am 06.11.19 um 10:14 schrieb Pan Bian:
> > The object fence is not set to NULL after its reference is dropped. As a
> > result, its reference may be dropped again if error occurs after that,
> > which may lead to a use after free bug. To avoid the issue, fence is
> > explicitly set to NULL after dropping its reference.
> >
> > Signed-off-by: Pan Bian <bianpan2016@163.com>
>
> Acked-by: Christian König <christian.koenig@amd.com>

Applied.  thanks!

Alex

>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > index b66d29d5ffa2..b158230af8db 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > @@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
> >               }
> >
> >               dma_fence_put(fence);
> > +             fence = NULL;
> >
> >               r = amdgpu_bo_kmap(vram_obj, &vram_map);
> >               if (r) {
> > @@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
> >               }
> >
> >               dma_fence_put(fence);
> > +             fence = NULL;
> >
> >               r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
> >               if (r) {
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/amdgpu: fix potential double drop fence reference
@ 2019-11-06 17:19     ` Alex Deucher
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2019-11-06 17:19 UTC (permalink / raw)
  To: Koenig, Christian
  Cc: Zhou, David(ChunMing),
	David Airlie, Pan Bian, linux-kernel, dri-devel, amd-gfx,
	Daniel Vetter, Deucher, Alexander, Sam Ravnborg

On Wed, Nov 6, 2019 at 4:39 AM Koenig, Christian
<Christian.Koenig@amd.com> wrote:
>
> Am 06.11.19 um 10:14 schrieb Pan Bian:
> > The object fence is not set to NULL after its reference is dropped. As a
> > result, its reference may be dropped again if error occurs after that,
> > which may lead to a use after free bug. To avoid the issue, fence is
> > explicitly set to NULL after dropping its reference.
> >
> > Signed-off-by: Pan Bian <bianpan2016@163.com>
>
> Acked-by: Christian König <christian.koenig@amd.com>

Applied.  thanks!

Alex

>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > index b66d29d5ffa2..b158230af8db 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
> > @@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
> >               }
> >
> >               dma_fence_put(fence);
> > +             fence = NULL;
> >
> >               r = amdgpu_bo_kmap(vram_obj, &vram_map);
> >               if (r) {
> > @@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
> >               }
> >
> >               dma_fence_put(fence);
> > +             fence = NULL;
> >
> >               r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
> >               if (r) {
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2019-11-07  7:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  9:14 [PATCH] drm/amdgpu: fix potential double drop fence reference Pan Bian
2019-11-06  9:14 ` Pan Bian
2019-11-06  9:14 ` Pan Bian
2019-11-06  9:38 ` Koenig, Christian
2019-11-06  9:38   ` Koenig, Christian
2019-11-06  9:38   ` Koenig, Christian
2019-11-06 17:19   ` Alex Deucher
2019-11-06 17:19     ` Alex Deucher
2019-11-06 17:19     ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.