Skip to content

Commit 2df7aac

Browse files
Ma Kepatjak
authored andcommitted
drm/gma500: fix null pointer dereference in psb_intel_lvds_get_modes
In psb_intel_lvds_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: 89c7813 ("gma500: Add Poulsbo support") Signed-off-by: Ma Ke <[email protected]> Signed-off-by: Patrik Jakobsson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a695949 commit 2df7aac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/gma500/psb_intel_lvds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector)
504504
if (mode_dev->panel_fixed_mode != NULL) {
505505
struct drm_display_mode *mode =
506506
drm_mode_duplicate(dev, mode_dev->panel_fixed_mode);
507+
if (!mode)
508+
return 0;
509+
507510
drm_mode_probed_add(connector, mode);
508511
return 1;
509512
}

0 commit comments

Comments
 (0)