* [PATCH] drm/nouveau/disp: Fix potential NULL pointer dereference in nouveau_dp_irq
@ 2026-03-16 17:26 Alexey Nepomnyashih
2026-03-16 17:42 ` Timur Tabi
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Nepomnyashih @ 2026-03-16 17:26 UTC (permalink / raw)
To: Lyude Paul
Cc: Alexey Nepomnyashih, Danilo Krummrich, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Ben Skeggs, dri-devel, nouveau, linux-kernel, lvc-project, stable
nouveau_dp_irq() dereferences the encoder pointer before verifying
that it is valid. The drm pointer is initialized using
outp->base.base.dev prior to the NULL check:
struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
If no encoder is associated with the connector, this leads to a
NULL pointer dereference.
Move the drm initialization after the NULL check.
Fixes: 773eb04d14a1 ("drm/nouveau/disp: expose conn event class")
Cc: stable@vger.kernel.org
Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru>
---
drivers/gpu/drm/nouveau/nouveau_dp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c
index 55691ec44aba..738802358d85 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dp.c
@@ -486,7 +486,7 @@ nouveau_dp_irq(struct work_struct *work)
container_of(work, typeof(*nv_connector), irq_work);
struct drm_connector *connector = &nv_connector->base;
struct nouveau_encoder *outp = find_encoder(connector, DCB_OUTPUT_DP);
- struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
+ struct nouveau_drm *drm;
struct nv50_mstm *mstm;
u64 hpd = 0;
int ret;
@@ -494,6 +494,8 @@ nouveau_dp_irq(struct work_struct *work)
if (!outp)
return;
+ drm = nouveau_drm(outp->base.base.dev);
+
mstm = outp->dp.mstm;
NV_DEBUG(drm, "service %s\n", connector->name);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/nouveau/disp: Fix potential NULL pointer dereference in nouveau_dp_irq
2026-03-16 17:26 [PATCH] drm/nouveau/disp: Fix potential NULL pointer dereference in nouveau_dp_irq Alexey Nepomnyashih
@ 2026-03-16 17:42 ` Timur Tabi
2026-03-16 18:09 ` SDL
0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2026-03-16 17:42 UTC (permalink / raw)
To: sdl@nppct.ru, lyude@redhat.com
Cc: bskeggs@redhat.com, simona@ffwll.ch,
dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, dakr@kernel.org,
maarten.lankhorst@linux.intel.com, lvc-project@linuxtesting.org,
mripard@kernel.org, stable@vger.kernel.org
On Mon, 2026-03-16 at 17:26 +0000, Alexey Nepomnyashih wrote:
> nouveau_dp_irq() dereferences the encoder pointer before verifying
> that it is valid. The drm pointer is initialized using
> outp->base.base.dev prior to the NULL check:
>
> struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
>
> If no encoder is associated with the connector, this leads to a
> NULL pointer dereference.
Can you provide an example of how/when this would be the case?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/nouveau/disp: Fix potential NULL pointer dereference in nouveau_dp_irq
2026-03-16 17:42 ` Timur Tabi
@ 2026-03-16 18:09 ` SDL
2026-03-16 18:34 ` Timur Tabi
0 siblings, 1 reply; 4+ messages in thread
From: SDL @ 2026-03-16 18:09 UTC (permalink / raw)
To: Timur Tabi, lyude@redhat.com
Cc: bskeggs@redhat.com, simona@ffwll.ch,
dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, dakr@kernel.org,
maarten.lankhorst@linux.intel.com, lvc-project@linuxtesting.org,
mripard@kernel.org, stable@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
> Can you provide an example of how/when this would be the case?
The issue was discovered through static analysis after reviewing changes
introduced
by commit 773eb04d14a1 ("drm/nouveau/disp: expose conn event class").
Originally, nouveau_dp_irq() checked the result of find_encoder() before
using it:
struct nouveau_encoder *outp = find_encoder(connector, DCB_OUTPUT_DP);
if (!outp)
return;
Commit 773eb04d14a1 introduced the line:
struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
before the existing if (!outp) guard. As a result, outp is now dereferenced
prior to the NULL check. The patch simply restores the correct ordering
by moving
the initialization of drm after the outp validation.
[-- Attachment #2: Type: text/html, Size: 1308 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/nouveau/disp: Fix potential NULL pointer dereference in nouveau_dp_irq
2026-03-16 18:09 ` SDL
@ 2026-03-16 18:34 ` Timur Tabi
0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2026-03-16 18:34 UTC (permalink / raw)
To: sdl@nppct.ru, lyude@redhat.com
Cc: simona@ffwll.ch, dri-devel@lists.freedesktop.org,
nouveau@lists.freedesktop.org, lvc-project@linuxtesting.org,
dakr@kernel.org, maarten.lankhorst@linux.intel.com,
stable@vger.kernel.org, mripard@kernel.org,
linux-kernel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
On Mon, 2026-03-16 at 21:09 +0300, SDL wrote:
The issue was discovered through static analysis after reviewing changes introduced
by commit 773eb04d14a1 ("drm/nouveau/disp: expose conn event class").
Please update the patch description with this info.
[-- Attachment #2: Type: text/html, Size: 825 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-16 18:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 17:26 [PATCH] drm/nouveau/disp: Fix potential NULL pointer dereference in nouveau_dp_irq Alexey Nepomnyashih
2026-03-16 17:42 ` Timur Tabi
2026-03-16 18:09 ` SDL
2026-03-16 18:34 ` Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox