Skip to content

Commit a986f93

Browse files
Nicholas Kazlauskasgregkh
authored andcommitted
drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails
[ Upstream commit 44a09e3 ] [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>
1 parent 3418abd commit a986f93

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/gpu/drm/amd/display/dc/core/dc_link.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,11 @@ static bool dc_link_construct(struct dc_link *link,
14541454
goto ddc_create_fail;
14551455
}
14561456

1457+
if (!link->ddc->ddc_pin) {
1458+
DC_ERROR("Failed to get I2C info for connector!\n");
1459+
goto ddc_create_fail;
1460+
}
1461+
14571462
link->ddc_hw_inst =
14581463
dal_ddc_get_line(dal_ddc_service_get_ddc_pin(link->ddc));
14591464

0 commit comments

Comments
 (0)