kernel/mutex: prevent priority inheritance from lowering owner's prio

If the system's priority inheritance priority ceiling is not the same as
the highest priority in the system, it was possible for a thread owning
the mutex to get its priority lowered instead of left unchanged.

Change-Id: Ic06a1c4a66322c2949b2ba2f53efa03200fb1fc1
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
This commit is contained in:
Benjamin Walsh 2017-01-14 18:57:58 -05:00 committed by Anas Nashif
parent e669559010
commit 4bfa0055b7

View file

@ -173,7 +173,9 @@ int k_mutex_lock(struct k_mutex *mutex, int32_t timeout)
K_DEBUG("adjusting prio up on mutex %p\n", mutex);
adjust_owner_prio(mutex, new_prio);
if (_is_prio_higher(new_prio, mutex->owner->base.prio)) {
adjust_owner_prio(mutex, new_prio);
}
_pend_current_thread(&mutex->wait_q, timeout);