Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69765529 authored by Steve French's avatar Steve French
Browse files

[CIFS] Fix oops in cifs_strfromUCS_le mounting to servers which do not specify their OS

Fixes kernel bug #10451 http://bugzilla.kernel.org/show_bug.cgi?id=10451



Certain NAS appliances do not set the operating system or network operating system
fields in the session setup response on the wire.  cifs was oopsing on the unexpected
zero length response fields (when trying to null terminate a zero length field).

This fixes the oops.

Acked-by: default avatarJeff Layton <jlayton@redhat.com>
CC: stable <stable@kernel.org>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 44f68fad
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ specified and user does not have access to query information about the
top of the share.  Fix problem in 2.6.28 resolving DFS paths to
Samba servers (worked to Windows).  Fix rmdir so that pending search
(readdir) requests do not get invalid results which include the now
removed directory.
removed directory.  Fix oops in cifs_dfs_ref.c when prefixpath is not reachable
when using DFS.

Version 1.55
------------
+2 −2
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,

	kfree(ses->serverOS);
	/* UTF-8 string will not grow more than four times as big as UCS-16 */
	ses->serverOS = kzalloc(4 * len, GFP_KERNEL);
	ses->serverOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
	if (ses->serverOS != NULL)
		cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp);
	data += 2 * (len + 1);
@@ -241,7 +241,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
		return rc;

	kfree(ses->serverNOS);
	ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */
	ses->serverNOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
	if (ses->serverNOS != NULL) {
		cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len,
				   nls_cp);