drm/gma500: fix null pointer dereference in cdv_intel_lvds_get_modes
authorMa Ke <make24@iscas.ac.cn>
Tue, 9 Jul 2024 11:33:11 +0000 (19:33 +0800)
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Tue, 9 Jul 2024 18:02:14 +0000 (20:02 +0200)
commitcb520c3f366c77e8d69e4e2e2781a8ce48d98e79
tree523eb15aff39549c90fa9f0df23a28b08352122e
parent2df7aac81070987b0f052985856aa325a38debf6
drm/gma500: fix null pointer dereference in cdv_intel_lvds_get_modes

In cdv_intel_lvds_get_modes(), the return value of drm_mode_duplicate()
is assigned to mode, which will lead to a NULL pointer dereference on
failure of drm_mode_duplicate(). Add a check to avoid npd.

Cc: stable@vger.kernel.org
Fixes: 6a227d5fd6c4 ("gma500: Add support for Cedarview")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240709113311.37168-1-make24@iscas.ac.cn
drivers/gpu/drm/gma500/cdv_intel_lvds.c