This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7260437f7d6913cc884523a396cc9eb2252e390c
Author: yushuailong <[email protected]>
AuthorDate: Thu Sep 10 15:57:03 2026 +0800

    sched/sched: fix NULL param dereference in sched_setscheduler
    
    Add a NULL check for the param argument before dereferencing
    param->sched_priority. The sibling functions sched_setparam and
    sched_getparam already have this check; sched_setscheduler was
    the only one missing it, allowing a NULL pointer dereference
    via sched_setscheduler(0, SCHED_FIFO, NULL).
    
    Assisted-by: OpenAI Codex
    Signed-off-by: yushuailong <[email protected]>
---
 sched/sched/sched_setscheduler.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c
index 181641c7b48..c5a7ec74be8 100644
--- a/sched/sched/sched_setscheduler.c
+++ b/sched/sched/sched_setscheduler.c
@@ -172,6 +172,11 @@ int nxsched_set_scheduler(pid_t pid, int policy,
   irqstate_t flags;
   int ret = -EINVAL;
 
+  if (param == NULL)
+    {
+      return -EINVAL;
+    }
+
   /* Check if the task to modify the calling task */
 
   if (pid == 0)

Reply via email to