kernel: Fix NULL dereference in ThreadTimeUserTimer::Schedule().

The SpinLocker was always initialized to fThread->time_lock even though
fThread may be NULL. This looks like a simple oversight as the rest of
the method handles fThread being NULL and the team variants of these
timers have very similar logic and do the NULL check as well.

This fixes the last remaining KDL in the posixtestsuite.
This commit is contained in:
Michael Lotz 2016-12-12 11:42:28 +01:00
parent 83cd87d033
commit 1f7e5bde38

View File

@ -903,7 +903,7 @@ ThreadTimeUserTimer::Schedule(bigtime_t nextTime, bigtime_t interval,
uint32 flags, bigtime_t& _oldRemainingTime, bigtime_t& _oldInterval)
{
InterruptsWriteSequentialLocker locker(sUserTimerLock);
SpinLocker timeLocker(fThread->time_lock);
SpinLocker timeLocker(fThread != NULL ? &fThread->time_lock : NULL);
// get the current time, but only if needed
bool nowValid = fThread != NULL;