[PATCH 2/2] cobalt/sched: tp: check partition id obtained from user
Philippe Gerum
rpm at xenomai.org
Fri Aug 30 18:05:14 CEST 2019
Signed-off-by: Philippe Gerum <rpm at xenomai.org>
---
kernel/cobalt/sched-tp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/cobalt/sched-tp.c b/kernel/cobalt/sched-tp.c
index d3e2586b0..ccff37428 100644
--- a/kernel/cobalt/sched-tp.c
+++ b/kernel/cobalt/sched-tp.c
@@ -168,6 +168,10 @@ static int xnsched_tp_chkparam(struct xnthread *thread,
{
struct xnsched_tp *tp = &thread->sched->tp;
+ if (p->tp.ptid < 0 ||
+ p->tp.ptid >= CONFIG_XENO_OPT_SCHED_TP_NRPART)
+ return -EINVAL;
+
if (tp->gps == NULL ||
p->tp.prio < XNSCHED_TP_MIN_PRIO ||
p->tp.prio > XNSCHED_TP_MAX_PRIO)
--
2.21.0
More information about the Xenomai
mailing list