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: stable@vger.kernel.org Signed-off-by: Ma Ke <make24@iscas.ac.cn> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240625081828.2620794-1-make24@iscas.ac.cn
1 parent 6d411c8 commit 66edf3f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • drivers/gpu/drm/nouveau/dispnv04

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)