[PATCH] drm/radeon: avoid a possible array overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Young Xiao <YangX92@xxxxxxxxxxx>

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.

See commit e1718d97aa88 ("drm/amdgpu: avoid a possible
array overflow") for detail.

Signed-off-by: Young Xiao <YangX92@xxxxxxxxxxx>
---
 drivers/gpu/drm/radeon/radeon_atombios.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index f422a8d..9121961 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -583,6 +583,12 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
 				ATOM_DEVICE_CV_SUPPORT)
 				continue;
 
+			if (con_obj_id >= ARRAY_SIZE(object_connector_convert)) {
+				DRM_ERROR("invalid con_obj_id %d for device tag 0x%04x\n",
+					  con_obj_id, le16_to_cpu(path->usDeviceTag));
+				continue;
+			}
+
 			/* IGP chips */
 			if ((rdev->flags & RADEON_IS_IGP) &&
 			    (con_obj_id ==
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux