Skip to contentSkip to conversation

drm/nouveau/secboot/acr: fix memory leak

PATCH In review Gustavo A. R. Silva 4 participants 5 messages Jul 24, 2018 – Sep 14, 2018

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

PATCH 1/1 drm/nouveau/secboot/acr: fix memory leak

In case memory resources for *bl_desc* were allocated, release them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")

Fixes 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c +1 -0
index d02e183..5c14d6a 100644
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
 		bl = acr->hsbl_unload_blob;
 	} else {
 		nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+		kfree(bl_desc);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.7.4
#1 lore raw

Hi all,

Friendly ping! Who can take this?

Thanks
--
Gustavo

Quoted 23 lines · Gustavo A. R. Silva

In case memory resources for *bl_desc* were allocated, release them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")

Fixes 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c +1 -0
index d02e183..5c14d6a 100644
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
 		bl = acr->hsbl_unload_blob;
 	} else {
 		nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+		kfree(bl_desc);
 		return -EINVAL;
 	}
 
Reviewed-by
#2 lore raw
Quoted 19 lines · Gustavo A. R. Silva

Hi all,

Friendly ping! Who can take this?

Thanks
--
Gustavo

Quoted 10 lines · Gustavo A. R. Silva

In case memory resources for *bl_desc* were allocated, release them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")

Fixes 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon, · line 807

Quoted 13 lines
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c +1 -0
index d02e183..5c14d6a 100644
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
 		bl = acr->hsbl_unload_blob;
 	} else {
 		nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+		kfree(bl_desc);
 		return -EINVAL;
 	}
 

Hi Gustavo,

Seeing as how I've been working on this corner of Nouveau lately (don't ask, haha), I reviewed and also tested this. It looks good, you can add:

thanks,

Signature · 6 lines
John Hubbard
NVIDIA
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Reviewed-by
#3 lore raw
Quoted 36 lines · John Hubbard
Quoted 19 lines · Gustavo A. R. Silva

Hi all,

Friendly ping! Who can take this?

Thanks
--
Gustavo

Quoted 10 lines · Gustavo A. R. Silva

In case memory resources for *bl_desc* were allocated, release them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")

Fixes 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon, · line 807

Quoted 13 lines
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c +1 -0
index d02e183..5c14d6a 100644
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
             bl = acr->hsbl_unload_blob;
     } else {
             nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+            kfree(bl_desc);
             return -EINVAL;
     }
 

Hi Gustavo,

Quoted 4 lines

Seeing as how I've been working on this corner of Nouveau lately (don't ask, haha), I reviewed and also tested this. It looks good, you can add:

Ben can you take this?

-Kees

Signature · 6 lines
Kees Cook
Pixel Security
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#4 lore raw
Quoted 38 lines · Kees Cook
Quoted 36 lines · John Hubbard
Quoted 19 lines · Gustavo A. R. Silva

Hi all,

Friendly ping! Who can take this?

Thanks
--
Gustavo

Quoted 10 lines · Gustavo A. R. Silva

In case memory resources for *bl_desc* were allocated, release them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")

Fixes 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon, · line 807

Quoted 13 lines
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c +1 -0
index d02e183..5c14d6a 100644
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
             bl = acr->hsbl_unload_blob;
     } else {
             nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+            kfree(bl_desc);
             return -EINVAL;
     }
 

Hi Gustavo,

Quoted 8 lines
Quoted 4 lines

Seeing as how I've been working on this corner of Nouveau lately (don't ask, haha), I reviewed and also tested this. It looks good, you can add:

Ben can you take this?

I've got it in my tree. Thanks!

Quoted 10 lines

-Kees

--
Kees Cook
Pixel Security
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau