Skip to contentSkip to conversation

drm/amdgpu: fix parser init error path to avoid crash in parser fini

PATCH Applied Dave Airlie 3 participants 3 messages Mar 10, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix parser init error path to avoid crash in parser fini

From: Dave Airlie <[email protected]>

If we don't reset the chunk info in the error path, the subsequent fini path will double free.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
index d2d0f60..99424cb 100644
@@ -240,6 +240,8 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
 	for (; i >= 0; i--)
 		drm_free_large(p->chunks[i].kdata);
 	kfree(p->chunks);
+	p->chunks = NULL;
+	p->nchunks = 0;
 put_ctx:
 	amdgpu_ctx_put(p->ctx);
 free_chunk:
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170310021304.13391-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by
#2 lore raw

Am 10.03.2017 um 03:13 schrieb Dave Airlie:

Quoted 6 lines

From: Dave Airlie <[email protected]>

If we don't reset the chunk info in the error path, the subsequent fini path will double free.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index d2d0f60..99424cb 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · line 247

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
@@ -240,6 +240,8 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
  	for (; i >= 0; i--)
  		drm_free_large(p->chunks[i].kdata);
  	kfree(p->chunks);
+	p->chunks = NULL;
+	p->nchunks = 0;
  put_ctx:
  	amdgpu_ctx_put(p->ctx);
  free_chunk:

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 9da556f3-9390-0917-fa68-3b6bf7d967dd-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Applied
#4 lore raw
Quoted 11 lines · Christian König

Am 10.03.2017 um 03:13 schrieb Dave Airlie:

Quoted 7 lines

From: Dave Airlie <[email protected]>

If we don't reset the chunk info in the error path, the subsequent fini path will double free.

Applied. thanks!

Alex

Quoted 19 lines
Quoted 19 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
index d2d0f60..99424cb 100644
@@ -240,6 +240,8 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p,
 void *data)
        for (; i >= 0; i--)
                drm_free_large(p->chunks[i].kdata);
        kfree(p->chunks);
+       p->chunks = NULL;
+       p->nchunks = 0;
  put_ctx:
        amdgpu_ctx_put(p->ctx);
Quoted 8 lines
Quoted 1 line

free_chunk:

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx