diff options
author | John Lindgren <john.lindgren@tds.net> | 2011-03-24 19:28:31 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-03-31 20:16:04 -0400 |
commit | 97ea530f6fac1f9632b0c4792a2a56411454adbe (patch) | |
tree | 97d3d926de57b7791214599abcfeb3a970279ed2 /drivers/gpu/drm/radeon/radeon_atombios.c | |
parent | 0ce790e7d736cedc563e1fb4e998babf5a4dbc3d (diff) |
drm/radeon/kms: add some sanity checks to obj info record parsingi (v2)
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 <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atombios.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 02d5c415f499..99768d9d91da 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -675,7 +675,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
675 | ATOM_ENCODER_CAP_RECORD *cap_record; | 675 | ATOM_ENCODER_CAP_RECORD *cap_record; |
676 | u16 caps = 0; | 676 | u16 caps = 0; |
677 | 677 | ||
678 | while (record->ucRecordType > 0 && | 678 | while (record->ucRecordSize > 0 && |
679 | record->ucRecordType > 0 && | ||
679 | record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { | 680 | record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { |
680 | switch (record->ucRecordType) { | 681 | switch (record->ucRecordType) { |
681 | case ATOM_ENCODER_CAP_RECORD_TYPE: | 682 | case ATOM_ENCODER_CAP_RECORD_TYPE: |
@@ -720,7 +721,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
720 | break; | 721 | break; |
721 | } | 722 | } |
722 | 723 | ||
723 | while (record->ucRecordType > 0 && | 724 | while (record->ucRecordSize > 0 && |
725 | record->ucRecordType > 0 && | ||
724 | record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { | 726 | record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { |
725 | switch (record->ucRecordType) { | 727 | switch (record->ucRecordType) { |
726 | case ATOM_I2C_RECORD_TYPE: | 728 | case ATOM_I2C_RECORD_TYPE: |
@@ -782,10 +784,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
782 | ATOM_HPD_INT_RECORD *hpd_record; | 784 | ATOM_HPD_INT_RECORD *hpd_record; |
783 | ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; | 785 | ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; |
784 | 786 | ||
785 | while (record->ucRecordType > 0 | 787 | while (record->ucRecordSize > 0 && |
786 | && record-> | 788 | record->ucRecordType > 0 && |
787 | ucRecordType <= | 789 | record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { |
788 | ATOM_MAX_OBJECT_RECORD_NUMBER) { | ||
789 | switch (record->ucRecordType) { | 790 | switch (record->ucRecordType) { |
790 | case ATOM_I2C_RECORD_TYPE: | 791 | case ATOM_I2C_RECORD_TYPE: |
791 | i2c_record = | 792 | i2c_record = |