Module: xenomai-2.5 Branch: master Commit: af9b015e6389a4812ae8ba194c9edf53d9f58d8e URL: http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=af9b015e6389a4812ae8ba194c9edf53d9f58d8e
Author: Jan Kiszka <[email protected]> Date: Sun Apr 25 16:20:51 2010 +0200 nucleus: Fix bogus lock stealing case See "deny_stealing" mutex test case for the detailed scenario. The bug was caused by XNWAKEN/wwake remaining untouched when returning from xnsynch_acquire with the lock held. Namely, the robbed original owner restarted the acquisition and grabbed the lock in the fast path without properly resetting XNWAKEN. This happens now right after returning from xnpod_suspend_thread (we can only gain this state when entering suspension). Signed-off-by: Jan Kiszka <[email protected]> --- ksrc/nucleus/synch.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ksrc/nucleus/synch.c b/ksrc/nucleus/synch.c index 7464951..7299405 100644 --- a/ksrc/nucleus/synch.c +++ b/ksrc/nucleus/synch.c @@ -514,6 +514,9 @@ xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout, xnpod_suspend_thread(thread, XNPEND, timeout, timeout_mode, synch); + thread->wwake = NULL; + xnthread_clear_info(thread, XNWAKEN); + if (xnthread_test_info(thread, XNRMID | XNTIMEO | XNBREAK)) goto unlock_and_exit; @@ -548,9 +551,6 @@ xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout, unlock_and_exit: - thread->wwake = NULL; - xnthread_clear_info(thread, XNWAKEN); - xnlock_put_irqrestore(&nklock, s); return xnthread_test_info(thread, XNRMID|XNTIMEO|XNBREAK); _______________________________________________ Xenomai-git mailing list [email protected] https://mail.gna.org/listinfo/xenomai-git
