[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-5a447f09a8dffc0dd7569aec614ad3613a050098@git.kernel.org>
Date: Mon, 20 Jul 2015 02:40:23 -0700
From: tip-bot for Thomas Gleixner <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: gregkh@...uxfoundation.org, mingo@...nel.org,
linux-kernel@...r.kernel.org, peterz@...radead.org,
tglx@...utronix.de, hpa@...or.com, shigekatsu.tateno@...el.com
Subject: [tip:timers/core] staging: ozwpan: Fix hrtimer wreckage
Commit-ID: 5a447f09a8dffc0dd7569aec614ad3613a050098
Gitweb: http://git.kernel.org/tip/5a447f09a8dffc0dd7569aec614ad3613a050098
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Mon, 13 Apr 2015 21:02:25 +0000
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Mon, 20 Jul 2015 11:37:46 +0200
staging: ozwpan: Fix hrtimer wreckage
oz_timer_add() modifies the expiry value of an active timer, which
results in data corruption.
Use hrtimer_start() and remove the silly conditional.
While at it use the proper helper function to convert milliseconds to
ktime.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Shigekatsu Tateno <shigekatsu.tateno@...el.com>
Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: devel@...verdev.osuosl.org
Link: http://lkml.kernel.org/r/20150413210035.357448657@linutronix.de
---
drivers/staging/ozwpan/ozproto.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index 1ba24a2..23aa817 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -566,23 +566,14 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time)
switch (type) {
case OZ_TIMER_TOUT:
case OZ_TIMER_STOP:
- if (hrtimer_active(&pd->timeout)) {
- hrtimer_set_expires(&pd->timeout, ktime_set(due_time /
- MSEC_PER_SEC, (due_time % MSEC_PER_SEC) *
- NSEC_PER_MSEC));
- hrtimer_start_expires(&pd->timeout, HRTIMER_MODE_REL);
- } else {
- hrtimer_start(&pd->timeout, ktime_set(due_time /
- MSEC_PER_SEC, (due_time % MSEC_PER_SEC) *
- NSEC_PER_MSEC), HRTIMER_MODE_REL);
- }
+ hrtimer_start(&pd->timeout, ms_to_ktime(due_time),
+ HRTIMER_MODE_REL);
pd->timeout_type = type;
break;
case OZ_TIMER_HEARTBEAT:
if (!hrtimer_active(&pd->heartbeat))
- hrtimer_start(&pd->heartbeat, ktime_set(due_time /
- MSEC_PER_SEC, (due_time % MSEC_PER_SEC) *
- NSEC_PER_MSEC), HRTIMER_MODE_REL);
+ hrtimer_start(&pd->heartbeat, ms_to_ktime(due_time),
+ HRTIMER_MODE_REL);
break;
}
spin_unlock_bh(&g_polling_lock);
--
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