[PATCH v2] Update currentTime in dispatch loop

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 18 18:47:44 PDT 2012


On Wed, Apr 18, 2012 at 06:36:12PM -0700, Chase Douglas wrote:
> A request, like input device grabs, may check a request timestamp
> against currentTime. It is possible for currentTime to lag a previously
> sent event timestamp. If the client makes a request based on such an
> event timestamp, the request may fail the validity check against
> currentTime unless we always update the time before processing the
> request.
> 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
> Changes from v1:
> * Move the update deeper in the function to inner loops, right before we
>   read the requests from clients. There cannot be any calls to
>   ProcessInputEvents in between the currentTime update and request
>   handling.
> 
>  dix/dispatch.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/dix/dispatch.c b/dix/dispatch.c
> index bce3a0d..9a2e22f 100644
> --- a/dix/dispatch.c
> +++ b/dix/dispatch.c
> @@ -393,6 +393,9 @@ Dispatch(void)
>                  }
>                  /* now, finally, deal with client requests */
>  
> +                /* Update currentTime so request time checks, such as for input
> +                 * device grabs, are calculated correctly */
> +                UpdateCurrentTimeIf();
>                  result = ReadRequestFromClient(client);
>                  if (result <= 0) {
>                      if (result < 0)
> -- 
> 1.7.9.1

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter


More information about the xorg-devel mailing list