nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found
@ 2023-05-22 20:18 Karol Herbst
  2023-05-23  9:37 ` Karol Herbst
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Herbst @ 2023-05-22 20:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, Ben Skeggs,
	Daniel Vetter, Gourav Samaiya

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found
  2023-05-22 20:18 [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found Karol Herbst
@ 2023-05-23  9:37 ` Karol Herbst
  2023-07-12 19:30   ` Dave Airlie
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Herbst @ 2023-05-23  9:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, Ben Skeggs,
	Daniel Vetter, Gourav Samaiya

On Mon, May 22, 2023 at 10:18 PM Karol Herbst <kherbst@redhat.com> 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 <kherbst@redhat.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..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
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found
  2023-05-23  9:37 ` Karol Herbst
@ 2023-07-12 19:30   ` Dave Airlie
  2023-07-12 20:38     ` Ben Skeggs
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2023-07-12 19:30 UTC (permalink / raw)
  To: Karol Herbst
  Cc: open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
	linux-kernel,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, Ben Skeggs,
	Daniel Vetter, Gourav Samaiya

On Tue, 23 May 2023 at 19:37, Karol Herbst <kherbst@redhat.com> wrote:
>
> On Mon, May 22, 2023 at 10:18 PM Karol Herbst <kherbst@redhat.com> 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 <kherbst@redhat.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..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 <airlied@redhat.com>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found
  2023-07-12 19:30   ` Dave Airlie
@ 2023-07-12 20:38     ` Ben Skeggs
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Skeggs @ 2023-07-12 20:38 UTC (permalink / raw)
  To: Dave Airlie
  Cc: open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
	linux-kernel,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, Ben Skeggs,
	Daniel Vetter, Gourav Samaiya

On Thu, 13 Jul 2023 at 05:31, Dave Airlie <airlied@gmail.com> wrote:
>
> On Tue, 23 May 2023 at 19:37, Karol Herbst <kherbst@redhat.com> wrote:
> >
> > On Mon, May 22, 2023 at 10:18 PM Karol Herbst <kherbst@redhat.com> 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 <kherbst@redhat.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..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 <airlied@redhat.com>
>
> >
> > >                 nvkm_debug(subdev, "No HSFW(s)\n");
> > >                 nvkm_acr_cleanup(acr);
> > >                 return 0;
> > > --
> > > 2.40.1
> > >
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-12 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 20:18 [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found Karol Herbst
2023-05-23  9:37 ` Karol Herbst
2023-07-12 19:30   ` Dave Airlie
2023-07-12 20:38     ` Ben Skeggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).