mirror of
https://github.com/apache/nuttx.git
synced 2026-10-04 12:48:09 +00:00
sched/group: Preserve the shared kernel group on init failure.
Kernel threads use the statically allocated g_kthread_group. If initialization of the first kernel thread fails, the common error path currently passes that static object to kmm_free(), corrupting the kernel heap. Only free dynamically allocated task groups and detach the failed group from the TCB before returning. Assisted-by: OpenAI Codex Signed-off-by: yushuailong <yyyusl@qq.com>
This commit is contained in:
parent
008521df5c
commit
84f363d79d
1 changed files with 6 additions and 1 deletions
|
|
@ -287,7 +287,12 @@ errout_with_group:
|
|||
}
|
||||
#endif
|
||||
|
||||
kmm_free(group);
|
||||
if (group != &g_kthread_group)
|
||||
{
|
||||
kmm_free(group);
|
||||
}
|
||||
|
||||
tcb->group = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue