AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: avoid a possible arrary overflow
@ 2019-06-03  3:02 Young Xiao
  0 siblings, 0 replies; only message in thread
From: Young Xiao @ 2019-06-03  3:02 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, David1.Zhou, airlied, daniel,
	amd-gfx, dri-devel, linux-kernel
  Cc: Young Xiao

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").

Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
 drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index f422a8d..971c541 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -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];
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-03  3:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-03  3:02 [PATCH] drm/radeon: avoid a possible arrary overflow Young Xiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox