Skip to content

Commit 926028a

Browse files
committed
Merge tag '6.1-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: - two missing and one incorrect return value checks - fix leak on tlink mount failure * tag '6.1-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: add check for returning value of SMB2_set_info_init cifs: Fix wrong return value checking when GETFLAGS cifs: add check for returning value of SMB2_close_init cifs: Fix connections leak when tlink setup failed
2 parents fe24a97 + a51e5d2 commit 926028a

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

fs/cifs/connect.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3855,9 +3855,13 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
38553855
uuid_copy(&cifs_sb->dfs_mount_id, &mnt_ctx.mount_id);
38563856

38573857
out:
3858-
free_xid(mnt_ctx.xid);
38593858
cifs_try_adding_channels(cifs_sb, mnt_ctx.ses);
3860-
return mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3859+
rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3860+
if (rc)
3861+
goto error;
3862+
3863+
free_xid(mnt_ctx.xid);
3864+
return rc;
38613865

38623866
error:
38633867
dfs_cache_put_refsrv_sessions(&mnt_ctx.mount_id);
@@ -3884,8 +3888,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
38843888
goto error;
38853889
}
38863890

3891+
rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3892+
if (rc)
3893+
goto error;
3894+
38873895
free_xid(mnt_ctx.xid);
3888-
return mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3896+
return rc;
38893897

38903898
error:
38913899
mount_put_conns(&mnt_ctx);

fs/cifs/ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
343343
rc = put_user(ExtAttrBits &
344344
FS_FL_USER_VISIBLE,
345345
(int __user *)arg);
346-
if (rc != EOPNOTSUPP)
346+
if (rc != -EOPNOTSUPP)
347347
break;
348348
}
349349
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
@@ -373,7 +373,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
373373
* pSMBFile->fid.netfid,
374374
* extAttrBits,
375375
* &ExtAttrMask);
376-
* if (rc != EOPNOTSUPP)
376+
* if (rc != -EOPNOTSUPP)
377377
* break;
378378
*/
379379

fs/cifs/smb2ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11161116
COMPOUND_FID, current->tgid,
11171117
FILE_FULL_EA_INFORMATION,
11181118
SMB2_O_INFO_FILE, 0, data, size);
1119+
if (rc)
1120+
goto sea_exit;
11191121
smb2_set_next_command(tcon, &rqst[1]);
11201122
smb2_set_related(&rqst[1]);
11211123

@@ -1126,6 +1128,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11261128
rqst[2].rq_nvec = 1;
11271129
rc = SMB2_close_init(tcon, server,
11281130
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
1131+
if (rc)
1132+
goto sea_exit;
11291133
smb2_set_related(&rqst[2]);
11301134

11311135
rc = compound_send_recv(xid, ses, server,

0 commit comments

Comments
 (0)