lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri,  4 Apr 2014 12:06:05 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	tglx@...utronix.de
Cc:	linaro-kernel@...ts.linaro.org, fweisbec@...il.com,
	linaro-networking@...aro.org, Arvind.Chauhan@....com,
	linux-kernel@...r.kernel.org,
	Viresh Kumar <viresh.kumar@...aro.org>
Subject: [PATCH V2 22/36] hrtimer: clear active_bases as soon as the timer is removed

Timers are removed from the red-black trees from __remove_hrtimer() and after
removing timer from the tree, it calls hrtimer_force_reprogram() which might use
value of cpu_base->active_bases. If the timer being removed is the last one on
that clock base, then cpu_base->active_bases wouldn't give the right value, as
there are no timers queued on the base but active base still marks it as active.

So, clear entry from active_bases as soon as timer is removed.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 kernel/hrtimer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 2d5bb9d..379d21a 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -895,6 +895,9 @@ static void __remove_hrtimer(struct hrtimer *timer,
 	next_timer = timerqueue_getnext(&base->active);
 	timerqueue_del(&base->active, &timer->node);
 
+	if (!timerqueue_getnext(&base->active))
+		base->cpu_base->active_bases &= ~(1 << base->index);
+
 #ifdef CONFIG_HIGH_RES_TIMERS
 	/* Reprogram the clock event device. if enabled */
 	if (reprogram && base->cpu_base->hres_active &&
@@ -907,8 +910,6 @@ static void __remove_hrtimer(struct hrtimer *timer,
 	}
 #endif
 	timer->state = newstate;
-	if (!timerqueue_getnext(&base->active))
-		base->cpu_base->active_bases &= ~(1 << base->index);
 }
 
 /*
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ