Skip to content

Commit 80bec68

Browse files
Ma KeLyude
authored andcommitted
drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes
In nouveau_connector_get_modes(), the return value of drm_mode_duplicate() is assigned to mode, which will lead to a possible NULL pointer dereference on failure of drm_mode_duplicate(). Add a check to avoid npd. Cc: [email protected] Fixes: 6ee7386 ("drm/nouveau: Add DRM driver for NVIDIA GPUs") Signed-off-by: Ma Ke <[email protected]> Signed-off-by: Lyude Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3285d8f commit 80bec68

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,9 @@ nouveau_connector_get_modes(struct drm_connector *connector)
10011001
struct drm_display_mode *mode;
10021002

10031003
mode = drm_mode_duplicate(dev, nv_connector->native_mode);
1004+
if (!mode)
1005+
return 0;
1006+
10041007
drm_mode_probed_add(connector, mode);
10051008
ret = 1;
10061009
}

0 commit comments

Comments
 (0)