semaphore:sem_boostholderprio prevent overrun of pend_reprios

The second case rtcb->sched_priority <= htcb->sched_priority
  did not check if there is sufficient space in the pend_reprios
  array.
This commit is contained in:
David Sidrane 2017-03-13 12:34:39 -10:00
parent 3c00651cfe
commit d66fd9f965

View File

@ -379,8 +379,16 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder,
* saved priority and not to the base priority.
*/
htcb->pend_reprios[htcb->npend_reprio] = rtcb->sched_priority;
htcb->npend_reprio++;
if (htcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
{
htcb->pend_reprios[htcb->npend_reprio] = rtcb->sched_priority;
htcb->npend_reprio++;
}
else
{
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(htcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
}
}
}