Skip to contentSkip to conversation

drm/radeon/kms: get HPD info for connectors

DISCUSSION Dan Carpenter 2 participants 2 messages Jun 21, 2013

lore
Share & tools
lore
#0 lore raw

Hello Alex Deucher,

The patch eed45b30cd14: "drm/radeon/kms: get HPD info for connectors" from Dec 4, 2009, leads to the following warning:
"drivers/gpu/drm/radeon/radeon_atombios.c:950 radeon_get_atom_connector_info_from_supported_devices_table()

	 error: buffer overflow 'supported_devices->info.asConnInfo' 10 <= 15"

drivers/gpu/drm/radeon/radeon_atombios.c
943 if (frev > 1)
944 max_device = ATOM_MAX_SUPPORTED_DEVICE;
945 else
946 max_device = ATOM_MAX_SUPPORTED_DEVICE_INFO;
947
948 for (i = 0; i < max_device; i++) {
949 ATOM_CONNECTOR_INFO_I2C ci =
950 supported_devices->info.asConnInfo[i];

If max_device is set to ATOM_MAX_SUPPORTED_DEVICE then we read beyond the end of the asConnInfo[] array and crash.

   951  
   952                  bios_connectors[i].valid = false;
   953  

regards,
dan carpenter

#1 lore raw
Quoted 18 lines · Dan Carpenter

Hello Alex Deucher,

The patch eed45b30cd14: "drm/radeon/kms: get HPD info for connectors" from Dec 4, 2009, leads to the following warning:
"drivers/gpu/drm/radeon/radeon_atombios.c:950 radeon_get_atom_connector_info_from_supported_devices_table()

         error: buffer overflow 'supported_devices->info.asConnInfo' 10 <= 15"

drivers/gpu/drm/radeon/radeon_atombios.c
943 if (frev > 1)

   944                  max_device = ATOM_MAX_SUPPORTED_DEVICE;
   945          else
   946                  max_device = ATOM_MAX_SUPPORTED_DEVICE_INFO;
   947
   948          for (i = 0; i < max_device; i++) {
   949                  ATOM_CONNECTOR_INFO_I2C ci =
   950                      supported_devices->info.asConnInfo[i];
Quoted 2 lines

If max_device is set to ATOM_MAX_SUPPORTED_DEVICE then we read beyond the end of the asConnInfo[] array and crash.

The array is variably sized based on the vbios version so the array size in the header is largely meaningless.

Alex

Quoted 8 lines
   951
   952                  bios_connectors[i].valid = false;
   953

regards,
dan carpenter