Module: xenomai-3
Branch: next
Commit: 2ca1b8509907c3990e40fd5feedaf04ce4716fd4
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2ca1b8509907c3990e40fd5feedaf04ce4716fd4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue May  9 11:09:05 2017 +0200

cobalt/clock: fix UMR in clock_nanosleep()

---

 kernel/cobalt/posix/clock.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index d6a315b..aa24808 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -266,8 +266,12 @@ int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,
                restart = cobalt_get_restart_block(current);
 
                if (restart->fn != cobalt_restart_syscall_placeholder) {
-                       if (rmt)
+                       if (rmt) {
+                               xnlock_get_irqsave(&nklock, s);
+                               rem = xntimer_get_timeout_stopped(&cur->rtimer);
+                               xnlock_put_irqrestore(&nklock, s);
                                ns2ts(rmt, rem > 1 ? rem : 0);
+                       }
                        return -EINTR;
                }
 


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

Reply via email to