summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2misc.c
diff options
context:
space:
mode:
authorAurelien Aptel2018-06-04 22:29:35 +0200
committerSteve French2018-06-07 15:31:31 +0200
commit8ddecf5fd728d3c6373394fa647d28e7c27f93a7 (patch)
treedf3913e2cb697e31eebca8180ea37180fbc36b8b /fs/cifs/smb2misc.c
parentCIFS: fix encryption in SMB3.1.1 (diff)
downloadkernel-qcow2-linux-8ddecf5fd728d3c6373394fa647d28e7c27f93a7.tar.gz
kernel-qcow2-linux-8ddecf5fd728d3c6373394fa647d28e7c27f93a7.tar.xz
kernel-qcow2-linux-8ddecf5fd728d3c6373394fa647d28e7c27f93a7.zip
CIFS: Fix NULL ptr deref
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>
Diffstat (limited to 'fs/cifs/smb2misc.c')
-rw-r--r--fs/cifs/smb2misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index cb5728e3d87d..e2bec47c6845 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -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;