Commit 8ddecf5f authored by Aurelien Aptel's avatar Aurelien Aptel Committed by Steve French

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: default avatarAurelien Aptel <aaptel@suse.com>
Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Acked-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
parent 83210ba6
...@@ -1019,6 +1019,12 @@ tlink_tcon(struct tcon_link *tlink) ...@@ -1019,6 +1019,12 @@ tlink_tcon(struct tcon_link *tlink)
return tlink->tl_tcon; 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); extern void cifs_put_tlink(struct tcon_link *tlink);
static inline struct tcon_link * static inline struct tcon_link *
......
...@@ -3116,12 +3116,6 @@ cifs_put_tlink(struct tcon_link *tlink) ...@@ -3116,12 +3116,6 @@ cifs_put_tlink(struct tcon_link *tlink)
return; return;
} }
static inline struct tcon_link *
cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb)
{
return cifs_sb->master_tlink;
}
static int static int
compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)
{ {
......
...@@ -453,8 +453,10 @@ cifs_convert_path_to_utf16(const char *from, struct cifs_sb_info *cifs_sb) ...@@ -453,8 +453,10 @@ cifs_convert_path_to_utf16(const char *from, struct cifs_sb_info *cifs_sb)
start_of_path = from + 1; start_of_path = from + 1;
#ifdef CONFIG_CIFS_SMB311 #ifdef CONFIG_CIFS_SMB311
/* SMB311 POSIX extensions paths do not include leading slash */ /* 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; start_of_path = from + 1;
}
#endif /* 311 */ #endif /* 311 */
else else
start_of_path = from; start_of_path = from;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment