Skip to content

Commit 211baef

Browse files
vlendecsmfrench
authored andcommitted
cifs: Fix smb2_set_path_size()
If cifs_get_writable_path() finds a writable file, smb2_compound_op() must use that file's FID and not the COMPOUND_FID. Cc: stable@vger.kernel.org Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent d0dc411 commit 211baef

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

fs/cifs/smb2inode.c

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,32 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
234234
size[0] = 8; /* sizeof __le64 */
235235
data[0] = ptr;
236236

237-
rc = SMB2_set_info_init(tcon, server,
238-
&rqst[num_rqst], COMPOUND_FID,
239-
COMPOUND_FID, current->tgid,
240-
FILE_END_OF_FILE_INFORMATION,
241-
SMB2_O_INFO_FILE, 0, data, size);
237+
if (cfile) {
238+
rc = SMB2_set_info_init(tcon, server,
239+
&rqst[num_rqst],
240+
cfile->fid.persistent_fid,
241+
cfile->fid.volatile_fid,
242+
current->tgid,
243+
FILE_END_OF_FILE_INFORMATION,
244+
SMB2_O_INFO_FILE, 0,
245+
data, size);
246+
} else {
247+
rc = SMB2_set_info_init(tcon, server,
248+
&rqst[num_rqst],
249+
COMPOUND_FID,
250+
COMPOUND_FID,
251+
current->tgid,
252+
FILE_END_OF_FILE_INFORMATION,
253+
SMB2_O_INFO_FILE, 0,
254+
data, size);
255+
if (!rc) {
256+
smb2_set_next_command(tcon, &rqst[num_rqst]);
257+
smb2_set_related(&rqst[num_rqst]);
258+
}
259+
}
242260
if (rc)
243261
goto finished;
244-
smb2_set_next_command(tcon, &rqst[num_rqst]);
245-
smb2_set_related(&rqst[num_rqst++]);
262+
num_rqst++;
246263
trace_smb3_set_eof_enter(xid, ses->Suid, tcon->tid, full_path);
247264
break;
248265
case SMB2_OP_SET_INFO:

0 commit comments

Comments
 (0)