Skip to content

Commit

Permalink
drm/amd/display: fix a NULL pointer dereference in amdgpu_dm_i2c_xfer()
Browse files Browse the repository at this point in the history
commit b71f4ad upstream.

When ddc_service_construct() is called, it explicitly checks both the
link type and whether there is something on the link which will
dictate whether the pin is marked as hw_supported.

If the pin isn't set or the link is not set (such as from
unloading/reloading amdgpu in an IGT test) then fail the
amdgpu_dm_i2c_xfer() call.

Cc: stable@vger.kernel.org
Fixes: 22676bc ("drm/amd/display: Fix dmub soft hang for PSR 1")
Link: fwupd/fwupd#6327
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
superm1 authored and gregkh committed Nov 28, 2023
1 parent 51ffa1a commit fb5c134
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7219,6 +7219,9 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
int i;
int result = -EIO;

if (!ddc_service->ddc_pin || !ddc_service->ddc_pin->hw_info.hw_supported)
return result;

cmd.payloads = kcalloc(num, sizeof(struct i2c_payload), GFP_KERNEL);

if (!cmd.payloads)
Expand Down

0 comments on commit fb5c134

Please sign in to comment.