]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
CIFS: Fix NULL ptr deref
authorAurelien Aptel <aaptel@suse.com>
Mon, 4 Jun 2018 20:29:35 +0000 (22:29 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 7 Jun 2018 13:31:31 +0000 (08:31 -0500)
cifs->master_tlink is NULL against Win Server 2016 (which is
strange.. not sure why) and is dereferenced in cifs_sb_master_tcon().

move master_tlink getter to cifsglob.h so it can be used from
smb2misc.c

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/smb2misc.c

index 08d1cdd9670182d1edfc3347e7854f29ae310f79..1efa2e65bc1a8971f01811ac699a82cb7c1f1727 100644 (file)
@@ -1019,6 +1019,12 @@ tlink_tcon(struct tcon_link *tlink)
        return tlink->tl_tcon;
 }
 
+static inline struct tcon_link *
+cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb)
+{
+       return cifs_sb->master_tlink;
+}
+
 extern void cifs_put_tlink(struct tcon_link *tlink);
 
 static inline struct tcon_link *
index e5a2fe7f0dd45c80f3ac278d8d0fe3b4a3339dc6..9089b73809de3f034dbb62639fa2bd2c79a4c7da 100644 (file)
@@ -3116,12 +3116,6 @@ cifs_put_tlink(struct tcon_link *tlink)
        return;
 }
 
-static inline struct tcon_link *
-cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb)
-{
-       return cifs_sb->master_tlink;
-}
-
 static int
 compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)
 {
index cb5728e3d87d4b5b5a915abcb7aa6da2baa8810f..e2bec47c684580089a70e7914ec71d2f523da3e3 100644 (file)
@@ -453,8 +453,10 @@ cifs_convert_path_to_utf16(const char *from, struct cifs_sb_info *cifs_sb)
                start_of_path = from + 1;
 #ifdef CONFIG_CIFS_SMB311
        /* SMB311 POSIX extensions paths do not include leading slash */
-       else if (cifs_sb_master_tcon(cifs_sb)->posix_extensions)
+       else if (cifs_sb_master_tlink(cifs_sb) &&
+                cifs_sb_master_tcon(cifs_sb)->posix_extensions) {
                start_of_path = from + 1;
+       }
 #endif /* 311 */
        else
                start_of_path = from;