Skip to contentSkip to conversation

drm/amd/display: Check msg->size before starting aux transfer

PATCH In review Shirish S 2 participants 2 messages Mar 13, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -0
index 39cfe0f..8291d74 100644
@@ -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(
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1520922514-23140-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 7 lines · Shirish S

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.

Harry

Quoted 10 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +0 -0
index 39cfe0f..8291d74 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, · line 93

Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -0
@@ -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(

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx