diff mbox series

[SRU,L] drm/nouveau/acr: Abort loading ACR if no firmware was found

Message ID 20230904081143.25212-1-juerg.haefliger@canonical.com
State New
Headers show
Series [SRU,L] drm/nouveau/acr: Abort loading ACR if no firmware was found | expand

Commit Message

Juerg Haefliger Sept. 4, 2023, 8:11 a.m. UTC
From: Karol Herbst <kherbst@redhat.com>

BugLink: https://bugs.launchpad.net/bugs/2031352

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

Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212
Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230522201838.1496622-1-kherbst@redhat.com
(cherry picked from commit 938a06c8b7913455073506c33ae3bff029c3c4ef linux-next)
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tim Gardner Sept. 4, 2023, 12:38 p.m. UTC | #1
On 9/4/23 2:11 AM, Juerg Haefliger wrote:
> From: Karol Herbst <kherbst@redhat.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2031352
> 
> This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary
> firmware files couldn't be loaded.
> 
> Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212
> Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
> Signed-off-by: Karol Herbst <kherbst@redhat.com>
> Reviewed-by: Dave Airlie <airlied@redhat.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20230522201838.1496622-1-kherbst@redhat.com
> (cherry picked from commit 938a06c8b7913455073506c33ae3bff029c3c4ef linux-next)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> index 795f3a649b12..9b8ca4e898f9 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> @@ -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 || !acr->func->wpr_layout) {
>   		nvkm_debug(subdev, "No HSFW(s)\n");
>   		nvkm_acr_cleanup(acr);
>   		return 0;
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Roxana Nicolescu Sept. 5, 2023, 7:05 a.m. UTC | #2
On 04-09-2023 10:11, Juerg Haefliger wrote:
> From: Karol Herbst <kherbst@redhat.com>
>
> BugLink: https://bugs.launchpad.net/bugs/2031352
>
> This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary
> firmware files couldn't be loaded.
>
> Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212
> Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
> Signed-off-by: Karol Herbst <kherbst@redhat.com>
> Reviewed-by: Dave Airlie <airlied@redhat.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20230522201838.1496622-1-kherbst@redhat.com
> (cherry picked from commit 938a06c8b7913455073506c33ae3bff029c3c4ef linux-next)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> index 795f3a649b12..9b8ca4e898f9 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> @@ -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 || !acr->func->wpr_layout) {
>   		nvkm_debug(subdev, "No HSFW(s)\n");
>   		nvkm_acr_cleanup(acr);
>   		return 0;
Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Roxana Nicolescu Sept. 20, 2023, 8:46 a.m. UTC | #3
On 04/09/2023 10:11, Juerg Haefliger wrote:
> From: Karol Herbst <kherbst@redhat.com>
>
> BugLink: https://bugs.launchpad.net/bugs/2031352
>
> This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary
> firmware files couldn't be loaded.
>
> Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212
> Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
> Signed-off-by: Karol Herbst <kherbst@redhat.com>
> Reviewed-by: Dave Airlie <airlied@redhat.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20230522201838.1496622-1-kherbst@redhat.com
> (cherry picked from commit 938a06c8b7913455073506c33ae3bff029c3c4ef linux-next)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> index 795f3a649b12..9b8ca4e898f9 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
> @@ -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 || !acr->func->wpr_layout) {
>   		nvkm_debug(subdev, "No HSFW(s)\n");
>   		nvkm_acr_cleanup(acr);
>   		return 0;
It is already applied to lunar:master-next. Thanks!
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
index 795f3a649b12..9b8ca4e898f9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
@@ -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 || !acr->func->wpr_layout) {
 		nvkm_debug(subdev, "No HSFW(s)\n");
 		nvkm_acr_cleanup(acr);
 		return 0;