Skip to contentSkip to conversation

drm/nouveau: Do not leak client objects

PATCH In review Thierry Reding 3 participants 3 messages Oct 16, 2014 – Jun 6, 2015 1 message not in the archive

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

PATCH 1/1 drm/nouveau: Do not leak client objects

From: Thierry Reding <[email protected]>

The memory allocated for a nouveau_cli object in nouveau_cli_create() is never freed. Free the memory in nouveau_cli_destroy() to plug this leak.

kmemleak recorded this after running a couple of nouveau test programs. Note that kmemleak points at drm_open_helper() because for some reason it thinks that skipping the first two stack frames is a good idea.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -0
index 57238076049f..6dc2c915ba6e 100644
@@ -126,6 +126,7 @@ nouveau_cli_destroy(struct nouveau_cli *cli)
 	nouveau_vm_ref(NULL, &nvkm_client(&cli->base)->vm, NULL);
 	nvif_client_fini(&cli->base);
 	usif_client_fini(cli);
+	kfree(cli);
 }
 
 static void
Signature · 1 line
2.1.2
#1 lore raw
Quoted 19 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The memory allocated for a nouveau_cli object in nouveau_cli_create() is never freed. Free the memory in nouveau_cli_destroy() to plug this leak.

kmemleak recorded this after running a couple of nouveau test programs. Note that kmemleak points at drm_open_helper() because for some reason it thinks that skipping the first two stack frames is a good idea.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -0
index 57238076049f..6dc2c915ba6e 100644

drivers/gpu/drm/nouveau/nouveau_drm.c nouveau_cli_destroy(struct nouveau_cli *cli) · line 132

Quoted 7 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -0
@@ -126,6 +126,7 @@ nouveau_cli_destroy(struct nouveau_cli *cli)
 	nouveau_vm_ref(NULL, &nvkm_client(&cli->base)->vm, NULL);
 	nvif_client_fini(&cli->base);
 	usif_client_fini(cli);
+	kfree(cli);
 }
 
 static void

Ben, any chance you could pick this up?

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 20150605113525.GF17776-AwZRO8vwLAwmlAP/[email protected]

#3 lore raw
Quoted 26 lines · Thierry Reding
Quoted 25 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The memory allocated for a nouveau_cli object in nouveau_cli_create() is never freed. Free the memory in nouveau_cli_destroy() to plug this leak.

kmemleak recorded this after running a couple of nouveau test programs. Note that kmemleak points at drm_open_helper() because for some reason it thinks that skipping the first two stack frames is a good idea.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -0
index 57238076049f..6dc2c915ba6e 100644
@@ -126,6 +126,7 @@ nouveau_cli_destroy(struct nouveau_cli *cli)
      nouveau_vm_ref(NULL, &nvkm_client(&cli->base)->vm, NULL);
      nvif_client_fini(&cli->base);
      usif_client_fini(cli);
+     kfree(cli);
 }
 
Quoted 3 lines

drivers/gpu/drm/nouveau/nouveau_drm.c nouveau_cli_destroy(struct nouveau_cli *cli) · line 132

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -0
 static void

Ben, any chance you could pick this up?

Got it :) Thanks for the ping!

Ben.

Quoted 8 lines

Thierry

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau