lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 12 Feb 2016 01:35:58 -0800
From:	Deepa Dinamani <deepa.kernel@...il.com>
To:	linux-fsdevel@...r.kernel.org, y2038@...ts.linaro.org
Cc:	Arnd Bergmann <arnd@...db.de>, Dave Chinner <david@...morbit.com>,
	"Theodore Ts'o" <tytso@....edu>, linux-kernel@...r.kernel.org
Subject: [RFC v2a 04/12] fs: cifs: Make cnvrtDosUnixTm() y2038 safe

The seconds calculated from the server(DOS format)
cannot be saved in int data type as this cannot save
seconds since epoch after the year 2038.

Use long long for seconds field in cnvrtDosUnixTm(). This will
help represent 64 bit time even on 32 bit systems.

Note that even though the theoretical max on DOS times is 2107,
its APIs only support until the year 2099. This means we can
get away with 32 bit unsigned sec field. But, the sec field uses
long long to maintain uniformity in the kernel as the
theoretical max is used everywhere else.

Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
---
 fs/cifs/netmisc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 86bc0e5..52b41bd 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -962,7 +962,8 @@ static const int total_days_of_prev_months[] = {
 struct vfs_time cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)
 {
 	struct vfs_time ts;
-	int sec, min, days, month, year;
+	long long sec;
+	int min, days, month, year;
 	u16 date = le16_to_cpu(le_date);
 	u16 time = le16_to_cpu(le_time);
 	SMB_TIME *st = (SMB_TIME *)&time;
@@ -973,7 +974,7 @@ struct vfs_time cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)
 	sec = 2 * st->TwoSeconds;
 	min = st->Minutes;
 	if ((sec > 59) || (min > 59))
-		cifs_dbg(VFS, "illegal time min %d sec %d\n", min, sec);
+		cifs_dbg(VFS, "illegal time min %d sec %lld\n", min, sec);
 	sec += (min * 60);
 	sec += 60 * 60 * st->Hours;
 	if (st->Hours > 24)
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ