[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <n7mhniclwckv7jxu6zwbk5xs5ig7w3eka3j54ioxi4uaha2k2q@tammak7sbrgk>
Date: Sat, 7 Sep 2024 13:04:49 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Alyssa Ross <hi@...ssa.is>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org, Erin Shepherd <erin.shepherd@....eu>,
Ryan Lahfa <ryan@...fa.xyz>
Subject: Re: [PATCH] bcachefs: Fix negative timespecs
On Sat, Sep 07, 2024 at 06:00:26PM GMT, Alyssa Ross wrote:
> This fixes two problems in the handling of negative times:
>
> • rem is signed, but the rem * c->sb.nsec_per_time_unit operation
> produced a bogus unsigned result, because s32 * u32 = u32.
>
> • The timespec was not normalized (it could contain more than a
> billion nanoseconds).
>
> For example, { .tv_sec = -14245441, .tv_nsec = 750000000 }, after
> being round tripped through timespec_to_bch2_time and then
> bch2_time_to_timespec would come back as
> { .tv_sec = -14245440, .tv_nsec = 4044967296 } (more than 4 billion
> nanoseconds).
>
> Cc: stable@...r.kernel.org
> Fixes: 595c1e9bab7f ("bcachefs: Fix time handling")
> Closes: https://github.com/koverstreet/bcachefs/issues/743
> Co-developed-by: Erin Shepherd <erin.shepherd@....eu>
> Signed-off-by: Erin Shepherd <erin.shepherd@....eu>
> Co-developed-by: Ryan Lahfa <ryan@...fa.xyz>
> Signed-off-by: Ryan Lahfa <ryan@...fa.xyz>
> Signed-off-by: Alyssa Ross <hi@...ssa.is>
Thanks! Applied
Powered by blists - more mailing lists