[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140708064204.GD3977@localhost.localdomain>
Date: Tue, 8 Jul 2014 08:42:04 +0200
From: Richard Cochran <richardcochran@...il.com>
To: John Stultz <john.stultz@...aro.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Prarit Bhargava <prarit@...hat.com>,
Sharvil Nanavati <sharvil@...gle.com>,
stable <stable@...r.kernel.org>
Subject: Re: [PATCH] alarmtimer: Fix bug where relative alarm timers were
treated as absolute
On Mon, Jul 07, 2014 at 02:06:11PM -0700, John Stultz wrote:
> @@ -597,8 +602,16 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
>
> /* start the timer */
> timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval);
> - alarm_start(&timr->it.alarm.alarmtimer,
> - timespec_to_ktime(new_setting->it_value));
> + exp = timespec_to_ktime(new_setting->it_value);
> + /* Convert (if necessary) to absolute time */
> + if (flags != TIMER_ABSTIME) {
> + ktime_t now;
> +
> + now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();
> + exp = ktime_add(now, exp);
> + }
> +
> + alarm_start(&timr->it.alarm.alarmtimer, exp);
Nothing protects 'exp' from becoming invalid before queuing the alarm,
if the time base is reset on another cpu. Or would that be harmless
here?
> return 0;
> }
Thanks,
Richard
--
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