]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.85/isofs-fix-timestamps-beyond-2027.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.18.85 / isofs-fix-timestamps-beyond-2027.patch
CommitLineData
d992de84
GKH
1From 34be4dbf87fc3e474a842305394534216d428f5d Mon Sep 17 00:00:00 2001
2From: Arnd Bergmann <arnd@arndb.de>
3Date: Thu, 19 Oct 2017 16:47:48 +0200
4Subject: isofs: fix timestamps beyond 2027
5
6From: Arnd Bergmann <arnd@arndb.de>
7
8commit 34be4dbf87fc3e474a842305394534216d428f5d upstream.
9
10isofs uses a 'char' variable to load the number of years since
111900 for an inode timestamp. On architectures that use a signed
12char type by default, this results in an invalid date for
13anything beyond 2027.
14
15This changes the function argument to a 'u8' array, which
16is defined the same way on all architectures, and unambiguously
17lets us use years until 2155.
18
19This should be backported to all kernels that might still be
20in use by that date.
21
22Signed-off-by: Arnd Bergmann <arnd@arndb.de>
23Signed-off-by: Jan Kara <jack@suse.cz>
24Signed-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@@ -14,7 +14,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, days, i;