Skip to content

Commit 66edf3f

Browse files
Ma KeLyude
authored andcommitted
drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_ld_modes
In nv17_tv_get_ld_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] 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 6d411c8 commit 66edf3f

File tree

1 file changed

+2
-0
lines changed
  • drivers/gpu/drm/nouveau/dispnv04

1 file changed

+2
-0
lines changed

drivers/gpu/drm/nouveau/dispnv04/tvnv17.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ static int nv17_tv_get_ld_modes(struct drm_encoder *encoder,
209209
struct drm_display_mode *mode;
210210

211211
mode = drm_mode_duplicate(encoder->dev, tv_mode);
212+
if (!mode)
213+
continue;
212214

213215
mode->clock = tv_norm->tv_enc_mode.vrefresh *
214216
mode->htotal / 1000 *

0 commit comments

Comments
 (0)