drm/radeon/kms: add some sanity checks to obj info record parsing
Subsystems (2)
PATCH 1/1 drm/radeon/kms: add some sanity checks to obj info record parsing
From: John Lindgren <[email protected]>
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=35502
agd5f: also add sanity check to connector records.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/radeon/radeon_atombios.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +4 -2
@@ -678,7 +678,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)ATOM_ENCODER_CAP_RECORD *cap_record;u16 caps =0 ; -while (record->ucRecordType >0 && +while (record->ucRecordSize >0 && + record->ucRecordType >0 && record->ucRecordType <=ATOM_MAX_OBJECT_RECORD_NUMBER ) {switch (record->ucRecordType) {case ATOM_ENCODER_CAP_RECORD_TYPE :
@@ -723,7 +724,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)break ; } -while (record->ucRecordType >0 && +while (record->ucRecordSize >0 && + record->ucRecordType >0 && record->ucRecordType <=ATOM_MAX_OBJECT_RECORD_NUMBER ) {switch (record->ucRecordType) {case ATOM_I2C_RECORD_TYPE :
Signature · 6 lines
1.7.1.1 _______________________________________________ stable mailing list [email protected] http://linux.kernel.org/mailman/listinfo/stable
PATCH 1/1 drm/radeon/kms: add some sanity checks to obj info record parsingi (v2)
From: John Lindgren <[email protected]>
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=35502
agd5f: also add sanity check to connector records.
v2: fix one more case.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/radeon/radeon_atombios.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +7 -6
@@ -678,7 +678,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)ATOM_ENCODER_CAP_RECORD *cap_record;u16 caps =0 ; -while (record->ucRecordType >0 && +while (record->ucRecordSize >0 && + record->ucRecordType >0 && record->ucRecordType <=ATOM_MAX_OBJECT_RECORD_NUMBER ) {switch (record->ucRecordType) {case ATOM_ENCODER_CAP_RECORD_TYPE :
@@ -723,7 +724,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)break ; } -while (record->ucRecordType >0 && +while (record->ucRecordSize >0 && + record->ucRecordType >0 && record->ucRecordType <=ATOM_MAX_OBJECT_RECORD_NUMBER ) {switch (record->ucRecordType) {case ATOM_I2C_RECORD_TYPE :
@@ -785,10 +787,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)ATOM_HPD_INT_RECORD *hpd_record;ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; -while (record->ucRecordType >0 - && record-> - ucRecordType <= -ATOM_MAX_OBJECT_RECORD_NUMBER ) { +while (record->ucRecordSize >0 && + record->ucRecordType >0 && + record->ucRecordType <=ATOM_MAX_OBJECT_RECORD_NUMBER ) {switch (record->ucRecordType) {case ATOM_I2C_RECORD_TYPE : i2c_record =
Signature · 1 line
1.7.1.1