Commit ea9a897b authored by Harshvardhan Jha's avatar Harshvardhan Jha Committed by Daniel Vetter

drm/gma500: Fix end of loop tests for list_for_each_entry

The list_for_each_entry() iterator, "connector" in this code, can never be
NULL.  If we exit the loop without finding the correct  connector then
"connector" points invalid memory that is an offset from the list head.
This will eventually lead to memory corruption and presumably a kernel
crash.

Fixes: 9bd81acd ("gma500: Convert Oaktrail to work with new output handling")
Signed-off-by: default avatarHarshvardhan Jha <harshvardhan.jha@oracle.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210709073959.11443-1-harshvardhan.jha@oracle.com
parent 911684de
...@@ -117,7 +117,7 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder, ...@@ -117,7 +117,7 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder,
break; break;
} }
if (!connector) { if (list_entry_is_head(connector, &mode_config->connector_list, head)) {
DRM_ERROR("Couldn't find connector when setting mode"); DRM_ERROR("Couldn't find connector when setting mode");
gma_power_end(dev); gma_power_end(dev);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment