[PATCH 0/2] drm/nouveau: guard two render-node NULL derefs of absent NVKM subdevices
From: Zhenhao Wan
Date: Wed Aug 12 2026 - 11:06:15 EST
Two NULL-pointer dereferences are reachable by an unprivileged local user
holding a /dev/dri/renderD* fd when an optional NVKM component is legitimately
absent after probe.
When a subdevice/engine constructor returns -ENODEV, the NVKM device
constructor (NVKM_LAYOUT_ONCE) treats it as an optional absent component: it
deletes the subdevice, leaves the device-> pointer NULL, and continues probing.
disp can also be NULLed by nvkm_subdev_disable() (strap-driven) on a headless
card. nouveau still completes init and unconditionally registers a render node,
so two method sinks that assume the subdevice is present become reachable:
- the NV50/GF100 sw-class vblank methods load device->disp->vblank.index_nr
(disp == NULL on a headless card);
- GETPARAM_GRAPH_UNITS calls nvkm_gr_units(gr), which reads gr->func
(gr == NULL when GR construction returned -ENODEV).
Either yields a NULL read -> kernel oops -> panic-class local DoS.
Both fixes extend tolerance that neighbouring code already proves is expected:
the sw channel constructors already guard disp, and nvkm_gr_units() already
returns 0 when the engine exposes no units callback. No new control-flow paths
are added.
There is no Fixes: tag: these are long-standing bugs predating the nvkm
reorg, so they are sent to stable without one.
---
Zhenhao Wan (2):
drm/nouveau/sw: prevent NULL deref of disp in vblank methods
drm/nouveau: prevent NULL deref of gr in GETPARAM_GRAPH_UNITS
drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c | 2 +-
drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: db2ddb87143519e20a95aa36c60b36107b736a58
change-id: 20260812-nouveau-nvkm-absent-subdev-null-deref-f52db5c24408
Best regards,
--
Zhenhao Wan <whi4ed0g@xxxxxxxxx>