2023-05-22 20:26:56

by Karol Herbst

[permalink] [raw]
Subject: [PATCH] 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.

Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212
Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
Signed-off-by: Karol Herbst <[email protected]>
---
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..6388234c352c 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->wpr_layout) {
nvkm_debug(subdev, "No HSFW(s)\n");
nvkm_acr_cleanup(acr);
return 0;
--
2.40.1



2023-05-23 09:59:14

by Karol Herbst

[permalink] [raw]
Subject: Re: [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found

On Mon, May 22, 2023 at 10:18 PM Karol Herbst <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> 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..6388234c352c 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->wpr_layout) {

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

> nvkm_debug(subdev, "No HSFW(s)\n");
> nvkm_acr_cleanup(acr);
> return 0;
> --
> 2.40.1
>


2023-07-12 20:02:05

by Dave Airlie

[permalink] [raw]
Subject: Re: [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found

On Tue, 23 May 2023 at 19:37, Karol Herbst <[email protected]> wrote:
>
> On Mon, May 22, 2023 at 10:18 PM Karol Herbst <[email protected]> wrote:
> >
> > 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 <[email protected]>
> > ---
> > 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..6388234c352c 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->wpr_layout) {
>
> Now thinking about this, it should probably also check acr->func...

with that fixed if you think you need it,

Reviewed-by: Dave Airlie <[email protected]>

>
> > nvkm_debug(subdev, "No HSFW(s)\n");
> > nvkm_acr_cleanup(acr);
> > return 0;
> > --
> > 2.40.1
> >
>

2023-07-12 21:11:43

by Ben Skeggs

[permalink] [raw]
Subject: Re: [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found

On Thu, 13 Jul 2023 at 05:31, Dave Airlie <[email protected]> wrote:
>
> On Tue, 23 May 2023 at 19:37, Karol Herbst <[email protected]> wrote:
> >
> > On Mon, May 22, 2023 at 10:18 PM Karol Herbst <[email protected]> wrote:
> > >
> > > 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 <[email protected]>
> > > ---
> > > 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..6388234c352c 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->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.

>
> Reviewed-by: Dave Airlie <[email protected]>
>
> >
> > > nvkm_debug(subdev, "No HSFW(s)\n");
> > > nvkm_acr_cleanup(acr);
> > > return 0;
> > > --
> > > 2.40.1
> > >
> >