[PATCH gnumach v1 3/4] check task's max_priority when setting priority

[email protected]
Newsgroups gmane.os.hurd.bugs
Message-ID <1150e14ebf3aaa1f6141748d41b32bcd00099120.1778373361.git.dnietoc@gmail.com>
From: Diego Nieto Cid <[email protected]>

  * kern/task.c (task_priority): check new priority against the
    tasks max_priority. Reject with KERN_NO_ACCES when going
    higher than it.
---
 kern/task.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kern/task.c b/kern/task.c
index 61a30502..07d2a020 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -1163,6 +1163,10 @@ task_priority(
 		return KERN_INVALID_ARGUMENT;
 
 	task_lock(task);
+	if (task->max_priority > priority) {
+		task_unlock(task);
+		return KERN_NO_ACCESS;
+	}
 	task->priority = priority;
 
 	if (change_threads) {
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.