Skip to contentSkip to conversation

drm/nouveau/acr: Abort loading ACR if no firmware was found

PATCH In review Karol Herbst 3 participants 4 messages May 22, 2023 – Jul 12, 2023

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

PATCH 1/1 drm/nouveau/acr: Abort loading ACR if no firmware was found

This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary firmware files couldn't be loaded.

Fixes 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +1 -1
index 795f3a649b12..6388234c352c 100644
@@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev)
 	u64 falcons;
 	int ret, i;
 
-	if (list_empty(&acr->hsfw)) {
+	if (list_empty(&acr->hsfw) || !acr->func->wpr_layout) {
 		nvkm_debug(subdev, "No HSFW(s)\n");
 		nvkm_acr_cleanup(acr);
 		return 0;
Signature · 1 line
2.40.1
#1 lore raw
Quoted 16 lines · Karol Herbst

This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary firmware files couldn't be loaded.

Fixes 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +0 -0
index 795f3a649b12..6388234c352c 100644

drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c nvkm_acr_oneinit(struct nvkm_subdev *subdev) · line 227

Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +1 -1
@@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev)
        u64 falcons;
        int ret, i;
 
-       if (list_empty(&acr->hsfw)) {
+       if (list_empty(&acr->hsfw) || !acr->func->wpr_layout) {

Now thinking about this, it should probably also check acr->func...

Quoted 6 lines
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +0 -1
                nvkm_debug(subdev, "No HSFW(s)\n");
                nvkm_acr_cleanup(acr);
                return 0;
--

2.40.1

maintainer Reviewed-by
#2 lore raw
Quoted 21 lines · Karol Herbst
Quoted 19 lines · Karol Herbst

This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary firmware files couldn't be loaded.

Fixes 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +0 -0
index 795f3a649b12..6388234c352c 100644
@@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev)
        u64 falcons;
        int ret, i;
 
Quoted 4 lines

drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c nvkm_acr_oneinit(struct nvkm_subdev *subdev) · line 227

Quoted 2 lines
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +1 -1
-       if (list_empty(&acr->hsfw)) {
+       if (list_empty(&acr->hsfw) || !acr->func->wpr_layout) {

Now thinking about this, it should probably also check acr->func...

with that fixed if you think you need it,

Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +0 -1
                nvkm_debug(subdev, "No HSFW(s)\n");
                nvkm_acr_cleanup(acr);
                return 0;
--

2.40.1

#3 lore raw
Quoted 23 lines · Dave Airlie
Quoted 21 lines · Karol Herbst
Quoted 19 lines · Karol Herbst

This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary firmware files couldn't be loaded.

Fixes 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +0 -0
index 795f3a649b12..6388234c352c 100644
@@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev)
        u64 falcons;
        int ret, i;
 
Quoted 6 lines
Quoted 4 lines

drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c nvkm_acr_oneinit(struct nvkm_subdev *subdev) · line 227

Quoted 2 lines
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +1 -1
-       if (list_empty(&acr->hsfw)) {
+       if (list_empty(&acr->hsfw) || !acr->func->wpr_layout) {

Now thinking about this, it should probably also check acr->func...

with that fixed if you think you need it,

I don't *think* you do. I believe modprobe will fail for any case it can be NULL.

Quoted 11 lines
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +0 -1
                nvkm_debug(subdev, "No HSFW(s)\n");
                nvkm_acr_cleanup(acr);
                return 0;
--

2.40.1