]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.103/isofs-fix-timestamps-beyond-2027.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.103 / isofs-fix-timestamps-beyond-2027.patch
1 From 34be4dbf87fc3e474a842305394534216d428f5d Mon Sep 17 00:00:00 2001
2 From: Arnd Bergmann <arnd@arndb.de>
3 Date: Thu, 19 Oct 2017 16:47:48 +0200
4 Subject: isofs: fix timestamps beyond 2027
5
6 From: Arnd Bergmann <arnd@arndb.de>
7
8 commit 34be4dbf87fc3e474a842305394534216d428f5d upstream.
9
10 isofs uses a 'char' variable to load the number of years since
11 1900 for an inode timestamp. On architectures that use a signed
12 char type by default, this results in an invalid date for
13 anything beyond 2027.
14
15 This changes the function argument to a 'u8' array, which
16 is defined the same way on all architectures, and unambiguously
17 lets us use years until 2155.
18
19 This should be backported to all kernels that might still be
20 in use by that date.
21
22 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
23 Signed-off-by: Jan Kara <jack@suse.cz>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 fs/isofs/isofs.h | 2 +-
28 fs/isofs/rock.h | 2 +-
29 fs/isofs/util.c | 2 +-
30 3 files changed, 3 insertions(+), 3 deletions(-)
31
32 --- a/fs/isofs/isofs.h
33 +++ b/fs/isofs/isofs.h
34 @@ -103,7 +103,7 @@ static inline unsigned int isonum_733(ch
35 /* Ignore bigendian datum due to broken mastering programs */
36 return get_unaligned_le32(p);
37 }
38 -extern int iso_date(char *, int);
39 +extern int iso_date(u8 *, int);
40
41 struct inode; /* To make gcc happy */
42
43 --- a/fs/isofs/rock.h
44 +++ b/fs/isofs/rock.h
45 @@ -65,7 +65,7 @@ struct RR_PL_s {
46 };
47
48 struct stamp {
49 - char time[7];
50 + __u8 time[7]; /* actually 6 unsigned, 1 signed */
51 } __attribute__ ((packed));
52
53 struct RR_TF_s {
54 --- a/fs/isofs/util.c
55 +++ b/fs/isofs/util.c
56 @@ -15,7 +15,7 @@
57 * to GMT. Thus we should always be correct.
58 */
59
60 -int iso_date(char * p, int flag)
61 +int iso_date(u8 *p, int flag)
62 {
63 int year, month, day, hour, minute, second, tz;
64 int crtime;