diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2020-12-16 08:51:33 +1000 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2020-12-15 16:55:57 -0600 |
commit | 6cf5abbfa8c8a2826d56e38ed1956a0e2f0c85b9 (patch) | |
tree | 18de9d2a997c2d4e8c51a4288efa0b283c1558c6 /fs/cifs | |
parent | 0c2b5f7ce50c24099e8ed7d35936e89fe9ca26ff (diff) | |
download | linux-6cf5abbfa8c8a2826d56e38ed1956a0e2f0c85b9.tar.bz2 |
cifs: fix use after free in cifs_smb3_do_mount()
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 4c9e12b46810..ce0d0037fd0a 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -854,12 +854,14 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, if (IS_ERR(sb)) { root = ERR_CAST(sb); cifs_umount(cifs_sb); + cifs_sb = NULL; goto out; } if (sb->s_root) { cifs_dbg(FYI, "Use existing superblock\n"); cifs_umount(cifs_sb); + cifs_sb = NULL; } else { rc = cifs_read_super(sb); if (rc) { @@ -870,7 +872,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, sb->s_flags |= SB_ACTIVE; } - root = cifs_get_root(cifs_sb->ctx, sb); + root = cifs_get_root(cifs_sb ? cifs_sb->ctx : old_ctx, sb); if (IS_ERR(root)) goto out_super; |