[PATCH xf86-video-amdgpu 1/2] Fix crash in PCI probe path (v3)

Michel Dänzer michel at daenzer.net
Wed Oct 28 06:54:56 PDT 2015


On 28.10.2015 22:00, William Lewis wrote:
> Would it not make more sense to set pAMDGPUEnt->fd to -1 beneath the 
> error_amdgpu tag?

No:


> On 10/28/15 08:24, Jammy Zhou wrote:
>> +		pAMDGPUEnt = pPriv->ptr;

[...]

>> @@ -266,7 +256,6 @@ static Bool amdgpu_get_scrninfo(int entity_num, void *pci_dev)
>>   
>>   error_amdgpu:
>>   	drmClose(pAMDGPUEnt->fd);
>> -	pAMDGPUEnt->fd = 0;
>>   error_fd:
>>   	free(pPriv->ptr);
>>   	return FALSE;

pAMDGPUEnt == pPriv->ptr, so the memory pointed to by pAMDGPUEnt is
freed immediately after the removed assignment.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-driver-ati mailing list