cifs: fix use after free in cifs_smb3_do_mount()
Subsystems (2)
PATCH 1/1 cifs: fix use after free in cifs_smb3_do_mount()
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Ronnie Sahlberg <[email protected]>
--- fs/cifs/cifsfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/cifsfs.c +3 -1
@@ -836,12 +836,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) {
@@ -852,7 +854,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;
Signature · 1 line
2.13.6
Steve French
Appliedmerged into cifs-2.6.git for-next to address the issue Dan pointed out.
Quoted 38 lines · Ronnie Sahlberg
Reported-by Dan Carpenter <[email protected]>Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/cifsfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/cifs/cifsfs.c +3
-2@@ -836,12 +836,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) {@@ -852,7 +854,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; --2.13.6
Signature · 3 lines
Thanks, Steve