[PATCH] drm/nouveau: fix NULL pointer dereference in nouveau_abi16_ioctl_get_zcull_info
From: Jakub Ludera via B4 Relay
Date: Sun Dec 06 2026 - 00:10:31 EST
From: Jakub Ludera <jakub_ludera@xxxxxxx>
When the Graphics (GR) engine fails to initialize (for example, when
the required signed firmware blobs are unavailable), nvxx_gr(drm)
returns NULL. Calling DRM_IOCTL_NOUVEAU_GET_ZCULL_INFO from userspace
then dereferences a NULL pointer when checking gr->has_zcull_info.
Check that gr is non-NULL before dereferencing it so the ioctl cleanly
returns -ENOTTY instead of triggering a kernel Oops.
Fixes: 196b2b95fec4 ("drm/nouveau: Add DRM_IOCTL_NOUVEAU_GET_ZCULL_INFO")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jakub Ludera <jakub_ludera@xxxxxxx>
---
drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index edf867c1fdcb..2bd5fe874e3b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -340,7 +340,7 @@ nouveau_abi16_ioctl_get_zcull_info(ABI16_IOCTL_ARGS)
struct nvkm_gr *gr = nvxx_gr(drm);
struct drm_nouveau_get_zcull_info *out = data;
- if (gr->has_zcull_info) {
+ if (gr && gr->has_zcull_info) {
const struct nvkm_gr_zcull_info *i = &gr->zcull_info;
out->width_align_pixels = i->width_align_pixels;
---
base-commit: b5a1ab58fb6535064d79c26f3d53936e88769339
change-id: 20261205-drm-misc-next-5bdbfb0454da
Best regards,
--
Jakub Ludera <jakub_ludera@xxxxxxx>