]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: Fix handling of extended tv_sec
authorDavid Turner <novalis@novalis.org>
Tue, 24 Nov 2015 19:34:37 +0000 (14:34 -0500)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Jan 2016 21:12:46 +0000 (22:12 +0100)
commit74147da1b621c713937081929a7ffc175e9c4691
tree0d7734fc1a3c4fb22dcb0de6a807d0661405c05c
parentdce8179bf6a93d91e5c1edcde71a91cbb91c9f0b
ext4: Fix handling of extended tv_sec

commit a4dad1ae24f850410c4e60f22823cba1289b8d52 upstream.

In ext4, the bottom two bits of {a,c,m}time_extra are used to extend
the {a,c,m}time fields, deferring the year 2038 problem to the year
2446.

When decoding these extended fields, for times whose bottom 32 bits
would represent a negative number, sign extension causes the 64-bit
extended timestamp to be negative as well, which is not what's
intended.  This patch corrects that issue, so that the only negative
{a,c,m}times are those between 1901 and 1970 (as per 32-bit signed
timestamps).

Some older kernels might have written pre-1970 dates with 1,1 in the
extra bits.  This patch treats those incorrectly-encoded dates as
pre-1970, instead of post-2311, until kernel 4.20 is released.
Hopefully by then e2fsck will have fixed up the bad data.

Also add a comment explaining the encoding of ext4's extra {a,c,m}time
bits.

Signed-off-by: David Turner <novalis@novalis.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Mark Harris <mh8928@yahoo.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=23732
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit 6dfd5f6abf1825fc351f663bf630603f9b78251b)
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/ext4/ext4.h