[Xenomai] [PATCH 2/6] cobalt/posix: Avoid mapping remote threads in cobalt_sched_setscheduler_ex

Jan Kiszka jan.kiszka at siemens.com
Mon Jul 16 18:37:50 CEST 2018


From: Jan Kiszka <jan.kiszka at siemens.com>

Detect if the caller passed the PID of a remote thread that we do not
know yet. In that case, do not try to shadow anything, that will only
end up in a mess.

Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
---
 kernel/cobalt/posix/sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c
index 4ae8738c7b..9b61193845 100644
--- a/kernel/cobalt/posix/sched.c
+++ b/kernel/cobalt/posix/sched.c
@@ -752,7 +752,7 @@ int cobalt_sched_setscheduler_ex(pid_t pid,
 		thread = cobalt_current_thread();
 
 	if (thread == NULL) {
-		if (u_winoff == NULL)
+		if (u_winoff == NULL || pid != task_pid_vnr(current))
 			return -ESRCH;
 			
 		thread = cobalt_thread_shadow(current, &hkey, u_winoff);
-- 
2.16.4




More information about the Xenomai mailing list