diff options
author | Aurelien Aptel <aaptel@suse.com> | 2018-06-04 16:29:35 -0400 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2018-06-07 09:31:31 -0400 |
commit | 8ddecf5fd728d3c6373394fa647d28e7c27f93a7 (patch) | |
tree | df3913e2cb697e31eebca8180ea37180fbc36b8b | |
parent | 83210ba6f816823f1762fbe63bd4985d6274d205 (diff) |
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>
-rw-r--r-- | fs/cifs/cifsglob.h | 6 | ||||
-rw-r--r-- | fs/cifs/connect.c | 6 | ||||
-rw-r--r-- | fs/cifs/smb2misc.c | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 08d1cdd96701..1efa2e65bc1a 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -1019,6 +1019,12 @@ tlink_tcon(struct tcon_link *tlink) | |||
1019 | return tlink->tl_tcon; | 1019 | return tlink->tl_tcon; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | static inline struct tcon_link * | ||
1023 | cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb) | ||
1024 | { | ||
1025 | return cifs_sb->master_tlink; | ||
1026 | } | ||
1027 | |||
1022 | extern void cifs_put_tlink(struct tcon_link *tlink); | 1028 | extern void cifs_put_tlink(struct tcon_link *tlink); |
1023 | 1029 | ||
1024 | static inline struct tcon_link * | 1030 | static inline struct tcon_link * |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e5a2fe7f0dd4..9089b73809de 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -3116,12 +3116,6 @@ cifs_put_tlink(struct tcon_link *tlink) | |||
3116 | return; | 3116 | return; |
3117 | } | 3117 | } |
3118 | 3118 | ||
3119 | static inline struct tcon_link * | ||
3120 | cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb) | ||
3121 | { | ||
3122 | return cifs_sb->master_tlink; | ||
3123 | } | ||
3124 | |||
3125 | static int | 3119 | static int |
3126 | compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) | 3120 | compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) |
3127 | { | 3121 | { |
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) | |||
453 | start_of_path = from + 1; | 453 | start_of_path = from + 1; |
454 | #ifdef CONFIG_CIFS_SMB311 | 454 | #ifdef CONFIG_CIFS_SMB311 |
455 | /* SMB311 POSIX extensions paths do not include leading slash */ | 455 | /* SMB311 POSIX extensions paths do not include leading slash */ |
456 | else if (cifs_sb_master_tcon(cifs_sb)->posix_extensions) | 456 | else if (cifs_sb_master_tlink(cifs_sb) && |
457 | cifs_sb_master_tcon(cifs_sb)->posix_extensions) { | ||
457 | start_of_path = from + 1; | 458 | start_of_path = from + 1; |
459 | } | ||
458 | #endif /* 311 */ | 460 | #endif /* 311 */ |
459 | else | 461 | else |
460 | start_of_path = from; | 462 | start_of_path = from; |