Patchwork [lucid/fsl-imx51,CVE,2/3] cifs: fix NULL pointer dereference in cifs_find_smb_ses

login
register
mail settings
Submitter Andy Whitcroft
Date Oct. 25, 2011, 4:12 p.m.
Message ID <1319559148-30401-4-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/121738/
State New
Headers show

Comments

Andy Whitcroft - Oct. 25, 2011, 4:12 p.m.
From: Jeff Layton <jlayton@redhat.com>

cifs_find_smb_ses assumes that the vol->password field is a valid
pointer, but that's only the case if a password was passed in via
the options string. It's possible that one won't be if there is
no mount helper on the box.

Reported-by: diabel <gacek-2004@wp.pl>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

(cherry picked from commit fc87a40677bbe0937e2ff0642c7e83c9a4813f3d)
CVE-2011-1585
BugLink: http://bugs.launchpad.net/bugs/869208
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 fs/cifs/connect.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 2ea5948..bbf1c25 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1583,7 +1583,8 @@  cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
 				    MAX_USERNAME_SIZE))
 				continue;
 			if (strlen(vol->username) != 0 &&
-			    strncmp(ses->password, vol->password,
+			    strncmp(ses->password,
+				    vol->password ? vol->password : "",
 				    MAX_PASSWORD_SIZE))
 				continue;
 		}