[PATCH] dri2: Fix detection of wrong prime_id in GetScreenPrime.

Dave Airlie airlied at gmail.com
Wed Apr 30 15:01:38 PDT 2014


I thought I reviewed this,

Reviewed-by: Dave Airlie <airlied at redhat.com>


On 29 April 2014 20:11, Michal Srb <msrb at suse.com> wrote:
> No response? It's simple change and fixes client triggered crash...
>
> On Tuesday April 15 2014 18:54:35 Michal Srb wrote:
>> Checking the iterating variable ("slave") against null can not detect if the
>> xorg_list_for_each_entry finished without break being invoked - slave
>> variable will be always non-null. This caused segfault whenever someone
>> tried to use DRI_PRIME with incorrect id while having at least one render
>> offloading slave configured.
>>
>> Restructurize the GetScreenPrime to work as expected.
>>
>> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
>> index 729a323..5b2c662 100644
>> --- a/hw/xfree86/dri2/dri2.c
>> +++ b/hw/xfree86/dri2/dri2.c
>> @@ -156,11 +156,9 @@ GetScreenPrime(ScreenPtr master, int prime_id)
>>
>>          ds = DRI2GetScreen(slave);
>>          if (ds->prime_id == prime_id)
>> -            break;
>> +            return slave;
>>      }
>> -    if (!slave)
>> -        return master;
>> -    return slave;
>> +    return master;
>>  }
>>
>>  static DRI2ScreenPtr
>>
>> _______________________________________________
>> xorg-devel at lists.x.org: X.Org development
>> Archives: http://lists.x.org/archives/xorg-devel
>> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list