Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70ab81c2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

posix cpu timers: fix timer ordering



Pointed out by Oleg Nesterov, who has been walking over the code
forwards and backwards.

Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b0917bd9
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -576,17 +576,15 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
	listpos = head;
	if (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {
		list_for_each_entry(next, head, entry) {
			if (next->expires.sched > nt->expires.sched) {
				listpos = &next->entry;
			if (next->expires.sched > nt->expires.sched)
				break;
			}
			listpos = &next->entry;
		}
	} else {
		list_for_each_entry(next, head, entry) {
			if (cputime_gt(next->expires.cpu, nt->expires.cpu)) {
				listpos = &next->entry;
			if (cputime_gt(next->expires.cpu, nt->expires.cpu))
				break;
			}
			listpos = &next->entry;
		}
	}
	list_add(&nt->entry, listpos);