[PATCH xserver 15/15] dri3: correctly handle failed get_supported_modifiers requests

Adam Jackson ajax at nwnk.net
Wed Apr 4 18:51:21 UTC 2018


On Mon, 2018-04-02 at 16:41 +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Currently depending on the code path hit, the helper will set some of
> the output values and not others.
> 
> It could also leak memory ;-)
> 
> At the same time the caller was:
>  - working around the broken behaviour - by initialising the variables
>  - outright ignoring if the helper fails
> 
> Fix all that by consistently setting the output variables and returning
> a protocol error if we fail to get the data required.
> 
> Bonus points: current code does not attribute if we cannot get the
> modifiers info for certain format. A smaller format array is available,
> yet the original length is stored.
> 
> Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers")
> Cc: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
> Cc: Daniel Stone <daniels at collabora.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> We could still return "success" to the user - I've opted for this
> solution since we already bail on dixLookupWindow failure.

This, combined with 10/15, means you will now throw BadImplementation
when we used to succeed and simply report no modifiers. I can't think
of a good reason to make that an error, it just makes the client's life
harder if it has to distinguish error from reply.

- ajax


More information about the xorg-devel mailing list