Skip to contentSkip to conversation

Patch "cifs: small underflow in cnvrtDosUnixTm()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Mar 22, 2018 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

cifs: small underflow in cnvrtDosUnixTm()

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
cifs-small-underflow-in-cnvrtdosunixtm.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Mar 22 14:57:32 CET 2018

From: Dan Carpenter <[email protected]>
Date: Mon, 1 May 2017 21:43:43 +0300
Subject: cifs: small underflow in cnvrtDosUnixTm()

From: Dan Carpenter <[email protected]>

[ Upstream commit 564277eceeca01e02b1ef3e141cfb939184601b4 ]

January is month 1. There is no zero-th month. If someone passes a zero month then it means we read from one space before the start of the total_days_of_prev_months[] array.

We may as well also be strict about days as well.

Fixes 1bd5bbcb6531 ("[CIFS] Legacy time handling for Win9x and OS/2 part 1")
---
 fs/cifs/netmisc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/cifs/netmisc.c +3 -3
@@ -980,10 +980,10 @@ struct timespec cnvrtDosUnixTm(__le16 le
 		cifs_dbg(VFS, "illegal hours %d\n", st->Hours);
 	days = sd->Day;
 	month = sd->Month;
-	if ((days > 31) || (month > 12)) {
+	if (days < 1 || days > 31 || month < 1 || month > 12) {
 		cifs_dbg(VFS, "illegal date, month %d day: %d\n", month, days);
-		if (month > 12)
-			month = 12;
+		days = clamp(days, 1, 31);
+		month = clamp(month, 1, 12);
 	}
 	month -= 1;
 	days += total_days_of_prev_months[month];

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/asoc-intel-skylake-uninitialized-variable-in-probe_codec.patch queue-4.4/mmc-host-omap_hsmmc-checking-for-null-instead-of-is_err.patch queue-4.4/hsi-ssi_protocol-double-free-in-ssip_pn_xmit.patch queue-4.4/cifs-small-underflow-in-cnvrtdosunixtm.patch