[PATCH v2] os: Fix timer race conditions
Keith Packard
keithp at keithp.com
Mon Jan 26 10:41:48 PST 2015
Aaron Plattner <aplattner at nvidia.com> writes:
> From: Nikhil Mahale <nmahale at nvidia.com>
>
> Fixing following kind of race-conditions -
>
> WaitForSomething()
> |
> ----> // timers -> timer-1 -> timer-2 -> null
> while (timers && (int) (timers->expires - now) <= 0)
> // prototype - DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
> DoTimer(timers, now, &timers)
> |
> |
> ----> OsBlockSignals(); .... OS Signal comes just before blocking it,
> .... timer-1 handler gets called.
> // timer-1 gets served and scheduled again;
> // timers -> timer-2 -> timer-1 -> null
> ....
> *prev = timer->next;
> timer->next = NULL; // timers -> null
> // timers list gets corrupted here and timer-2 gets removed from list.
>
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86288
> Signed-off-by: Nikhil Mahale <nmahale at nvidia.com>
> Reviewed-by: Julien Cristau <jcristau at debian.org>
>
> v2: Apply warning fixes from Keith Packard <keithp at keithp.com>
>
> Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
> Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
Merged.
58f28b0..fe4c774 master -> master
--
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20150126/ae0a5c10/attachment.sig>
More information about the xorg-devel
mailing list