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

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Jan 18 17:44:01 2013 +0100

nucleus: Fix migration race in schedule_linux_call

schedule_linux_call may also be invoked over preemptible, thus
migratable Linux contexts. Therefore we must not read the CPU number
outside the splhigh/splexit section.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 ksrc/nucleus/shadow.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 260fdef..c91a6f3 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -820,7 +820,7 @@ static void lostage_handler(void *cookie)
 
 static void schedule_linux_call(int type, struct task_struct *p, int arg)
 {
-       int cpu = rthal_processor_id(), reqnum;
+       int cpu, reqnum;
        struct __lostagerq *rq;
        spl_t s;
 
@@ -832,6 +832,7 @@ static void schedule_linux_call(int type, struct 
task_struct *p, int arg)
 
        splhigh(s);
 
+       cpu = rthal_processor_id();
        rq = &lostagerq[cpu];
        reqnum = rq->in;
        rq->in = (reqnum + 1) & (LO_MAX_REQUESTS - 1);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to