summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorShirish S <shirish.s@amd.com>2018-03-13 11:55:11 +0530
committerAlex Deucher <alexander.deucher@amd.com>2018-03-14 16:01:15 -0500
commit2a7b58293dd0f188d27491a8d07b145a9487e172 (patch)
tree19b26a5a02f520396692c26ec998e253deb6f095 /drivers/gpu/drm/amd
parent17ac50368f83ead67f9e3c9b9704f927f214da9d (diff)
drm/amd/display: Check msg->size before starting aux transfer
This patch adds an essential check related to the size of the payload to be transferred via aux channel. Without this check dal_ddc_service_read_dpcd_data() is fed with inappropriate payload size leading to deadlocks. Signed-off-by: Shirish S <shirish.s@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 39cfe0fbf1b9..8291d74f26bc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -85,6 +85,9 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
enum ddc_result res;
ssize_t read_bytes;
+ if (WARN_ON(msg->size > 16))
+ return -E2BIG;
+
switch (msg->request & ~DP_AUX_I2C_MOT) {
case DP_AUX_NATIVE_READ:
read_bytes = dal_ddc_service_read_dpcd_data(