stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* nv50_disp_chan_mthd: ensure mthd is not NULL
@ 2020-01-29 16:22 Frédéric Pierret
  2020-01-30  6:54 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Frédéric Pierret @ 2020-01-29 16:22 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: nouveau, stable


[-- Attachment #1.1.1: Type: text/plain, Size: 506 bytes --]

Dear Ben Skeggs,

Please find attached a patch solving a blocking issue I encountered:
https://bugzilla.kernel.org/show_bug.cgi?id=206299

Basically, running at least a RTX2080TI on Xen makes a bad mmio error
which causes having 'mthd' pointer to be NULL in 'channv50.c'. From the
code, it's assumed to be not NULL by accessing directly 'mthd->data[0]'
which is the reason of the kernel panic. I simply check if the pointer
is not NULL before continuing.

Best regards,

Frédéric Pierret


[-- Attachment #1.1.2: 0001-nv50_disp_chan_mthd-ensure-mthd-is-not-NULL.patch --]
[-- Type: text/x-patch, Size: 1215 bytes --]

From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
 <frederic.pierret@qubes-os.org>
Date: Sun, 26 Jan 2020 23:24:33 +0100
Subject: [PATCH] nv50_disp_chan_mthd: ensure mthd is not NULL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Pointer to structure array is assumed not NULL by default. It has
the consequence to raise a kernel panic when it's not the case.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206299
Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
index bcf32d92ee5a..50e3539f33d2 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
@@ -74,6 +74,8 @@ nv50_disp_chan_mthd(struct nv50_disp_chan *chan, int debug)
 
 	if (debug > subdev->debug)
 		return;
+	if (!mthd)
+		return;
 
 	for (i = 0; (list = mthd->data[i].mthd) != NULL; i++) {
 		u32 base = chan->head * mthd->addr;
-- 
2.21.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: nv50_disp_chan_mthd: ensure mthd is not NULL
  2020-01-29 16:22 nv50_disp_chan_mthd: ensure mthd is not NULL Frédéric Pierret
@ 2020-01-30  6:54 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2020-01-30  6:54 UTC (permalink / raw)
  To: Frédéric Pierret; +Cc: Ben Skeggs, nouveau, stable

On Wed, Jan 29, 2020 at 05:22:13PM +0100, Frédéric Pierret wrote:
> Dear Ben Skeggs,
> 
> Please find attached a patch solving a blocking issue I encountered:
> https://bugzilla.kernel.org/show_bug.cgi?id=206299
> 
> Basically, running at least a RTX2080TI on Xen makes a bad mmio error
> which causes having 'mthd' pointer to be NULL in 'channv50.c'. From the
> code, it's assumed to be not NULL by accessing directly 'mthd->data[0]'
> which is the reason of the kernel panic. I simply check if the pointer
> is not NULL before continuing.
> 
> Best regards,
> 
> Frédéric Pierret
> 

> From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
>  <frederic.pierret@qubes-os.org>
> Date: Sun, 26 Jan 2020 23:24:33 +0100
> Subject: [PATCH] nv50_disp_chan_mthd: ensure mthd is not NULL
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Pointer to structure array is assumed not NULL by default. It has
> the consequence to raise a kernel panic when it's not the case.
> 
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206299
> Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
> index bcf32d92ee5a..50e3539f33d2 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
> @@ -74,6 +74,8 @@ nv50_disp_chan_mthd(struct nv50_disp_chan *chan, int debug)
>  
>  	if (debug > subdev->debug)
>  		return;
> +	if (!mthd)
> +		return;
>  
>  	for (i = 0; (list = mthd->data[i].mthd) != NULL; i++) {
>  		u32 base = chan->head * mthd->addr;
> -- 
> 2.21.0
> 




<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

end of thread, other threads:[~2020-01-30  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-29 16:22 nv50_disp_chan_mthd: ensure mthd is not NULL Frédéric Pierret
2020-01-30  6:54 ` Greg KH

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