Module: xenomai-rpm
Branch: for-upstream
Commit: f1a7b1ec9962bdc66b5f46613bd4569ae63f19ff
URL:    
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=f1a7b1ec9962bdc66b5f46613bd4569ae63f19ff

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Oct 16 13:21:59 2010 +0200

nucleus: fix race in xnpod_set_thread_tslice()

---

 ksrc/nucleus/pod.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 2297b74..f5326bd 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -3077,11 +3077,13 @@ int xnpod_set_thread_tslice(struct xnthread *thread, 
xnticks_t quantum)
        int aperiodic;
        spl_t s;
 
-       if (thread->base_class->sched_tick == NULL)
-               return -EINVAL;
-
        xnlock_get_irqsave(&nklock, s);
 
+       if (thread->base_class->sched_tick == NULL) {
+               xnlock_put_irqrestore(&nklock, s);
+               return -EINVAL;
+       }
+
        aperiodic = !xntbase_periodic_p(xnthread_time_base(thread));
        thread->rrperiod = quantum;
        thread->rrcredit = quantum;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to