drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Fri, 18 Dec 2020 17:14:00 +0000 (12:14 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Mar 2021 11:34:11 +0000 (12:34 +0100)
commita986f9345467b8d39f0aff39d80207e4e91aae0c
tree223a7b13181541c4822e75a9e3799ca1d6441f7f
parent3418abd7c66f2221395067aa50677bab9be391a3
drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails

[ Upstream commit 44a09e3d95bd2b7b0c224100f78f335859c4e193 ]

[Why]
If the BIOS table is invalid or corrupt then get_i2c_info can fail
and we dereference a NULL pointer.

[How]
Check that ddc_pin is not NULL before using it and log an error if it
is because this is unexpected.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Eric Yang <eric.yang2@amd.com>
Acked-by: Anson Jacob <anson.jacob@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/core/dc_link.c