aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-08-18 13:13:39 -0400
committerSteve French <sfrench@us.ibm.com>2010-08-18 13:26:25 -0400
commitfc87a40677bbe0937e2ff0642c7e83c9a4813f3d (patch)
tree31912b8904ee316cee40d568db330c4e65e39325
parent232341ba7fa15115d40f6aa0f8dd14e96e3ad375 (diff)
cifs: fix NULL pointer dereference in cifs_find_smb_ses
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>
-rw-r--r--fs/cifs/connect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 95c2ea67edfb..446e2486d5f0 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1673,7 +1673,8 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
1673 MAX_USERNAME_SIZE)) 1673 MAX_USERNAME_SIZE))
1674 continue; 1674 continue;
1675 if (strlen(vol->username) != 0 && 1675 if (strlen(vol->username) != 0 &&
1676 strncmp(ses->password, vol->password, 1676 strncmp(ses->password,
1677 vol->password ? vol->password : "",
1677 MAX_PASSWORD_SIZE)) 1678 MAX_PASSWORD_SIZE))
1678 continue; 1679 continue;
1679 } 1680 }