]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cifs: fix NULL pointer dereference in cifs_find_smb_ses
authorJeff Layton <jlayton@redhat.com>
Wed, 18 Aug 2010 17:13:39 +0000 (13:13 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 8 Aug 2011 17:23:16 +0000 (10:23 -0700)
commit fc87a40677bbe0937e2ff0642c7e83c9a4813f3d upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/connect.c

index 73ddd0b40692463d18d6582ede45fb1cd5e829ca..e15b09457a96e75dec028572d4abee575b5c07dd 100644 (file)
@@ -1605,7 +1605,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;
                }