drm/gma500: Fix end of loop tests for list_for_each_entry
authorHarshvardhan Jha <harshvardhan.jha@oracle.com>
Fri, 9 Jul 2021 07:39:59 +0000 (13:09 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:50:31 +0000 (09:50 +0200)
commit3d58f5e83f97f2e732c3a00949a935e601d42529
treea731df0b72fab4af5b1e79aa3f7dcc5864400cb0
parent54912723f16ba0cdd7db57bb0d10f33bfff636f4
drm/gma500: Fix end of loop tests for list_for_each_entry

[ Upstream commit ea9a897b8affa0f7b4c90182b785dded74e434aa ]

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: 9bd81acdb648 ("gma500: Convert Oaktrail to work with new output handling")
Signed-off-by: Harshvardhan Jha <harshvardhan.jha@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210709073959.11443-1-harshvardhan.jha@oracle.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/gma500/oaktrail_lvds.c