Skip to contentSkip to conversation

drm/radeon: avoid a possible arrary overflow

PATCH New Young Xiao 1 participant 1 message Jun 3, 2019

Subsystems (2)
lore
Share & tools
lore

Young Xiao

author
#0 lore raw

PATCH 1/1 drm/radeon: avoid a possible arrary overflow

When looking up the connector type make sure the index is valid. Avoids a later crash if we read past the end of the array.

This bug is similar to the issue which was fixed in commit e1718d97aa88 ("drm/amdgpu: avoid a possible array overflow").

---
 drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_atombios.c +4 -0
index f422a8d..971c541 100644
@@ -632,6 +632,10 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
 					connector_object_id = con_obj_id;
 				}
 			} else {
+				if (con_obj_id >= ARRAY_SIZE(object_connector_convert)) {
+					DRM_ERROR("invalid con_obj_id %d\n", con_obj_id);
+					continue;
+				}
 				igp_lane_info = 0;
 				connector_type =
 				    object_connector_convert[con_obj_id];
Signature · 1 line
2.7.4