Skip to content
Snippets Groups Projects
Commit d812f254 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

sched/sched_releasetcb.c: Fix an error handling case where a pthread start-up...

sched/sched_releasetcb.c:  Fix an error handling case where a pthread start-up fails early, before the task type has been saved in the TCB.  It is safer to use the sched_releasetcb() task type argument instead of relying on the task type in the TCB to be valid.  Reported by David Sidrane
parent 1027d9f7
No related branches found
No related tags found
No related merge requests found
......@@ -5896,4 +5896,8 @@
Mikrow STM32F4 board from Ken Pettit (2013-10-27).
* arch/arm/src/stm32/stm32_spi.c: DMA-related fixe from Ken
Pettit (2013-10-27).
* sched/sched_releasetcb.c: Fix a cornercase: If sched_releasetcb()
is called as part of a failed pthread startup before the flags
field in the TCB has been initialized, then a crash occurs.
Pointed out by David Sidrane (2013-10-27)
......@@ -168,7 +168,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
*/
#ifndef CONFIG_DISABLE_PTHREAD
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD)
if (ttype != TCB_FLAG_TTYPE_PTHREAD)
#endif
{
FAR struct task_tcb_s *ttcb = (FAR struct task_tcb_s *)tcb;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment