Re: [PATCH] fix potential jiffies overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/2/06, Atsushi Nemoto <[email protected]> wrote:
> I found i386 timer_resume is updating jiffies, not jiffies_64.  It
> looks there is a potential overflow problem.  Is this a correct fix?
>
> Signed-off-by: Atsushi Nemoto <[email protected]>
>
> diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
> index a14d594..e4ed172 100644
> --- a/arch/i386/kernel/time.c
> +++ b/arch/i386/kernel/time.c
> @@ -413,7 +413,7 @@ static int timer_resume(struct sys_devic
>         xtime.tv_sec = sec;
>         xtime.tv_nsec = 0;
>         write_sequnlock_irqrestore(&xtime_lock, flags);
> -       jiffies += sleep_length;
> +       jiffies_64 += sleep_length;
>         wall_jiffies += sleep_length;
>         if (last_timer->resume)
>                 last_timer->resume();


The 64-bit jiffies value is not atomic. You need to hold xtime_lock to read it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux