Skip to content

Commit 74c7241

Browse files
Jethro DonaldsonSteve French
authored andcommitted
smb: client: fix zero length for mkdir POSIX create context
SMB create requests issued via smb311_posix_mkdir() have an incorrect length of zero bytes for the POSIX create context data. ksmbd server rejects such requests and logs "cli req too short" causing mkdir to fail with "invalid argument" on the client side. It also causes subsequent rmmod to crash in cifs_destroy_request_bufs() Inspection of packets sent by cifs.ko using wireshark show valid data for the SMB2_POSIX_CREATE_CONTEXT is appended with the correct offset, but with an incorrect length of zero bytes. Fails with ksmbd+cifs.ko only as Windows server/client does not use POSIX extensions. Fix smb311_posix_mkdir() to set req->CreateContextsLength as part of appending the POSIX creation context to the request. Signed-off-by: Jethro Donaldson <devel@jro.nz> Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent b443265 commit 74c7241

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/smb/client/smb2pdu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,6 +2921,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
29212921
req->CreateContextsOffset = cpu_to_le32(
29222922
sizeof(struct smb2_create_req) +
29232923
iov[1].iov_len);
2924+
le32_add_cpu(&req->CreateContextsLength, iov[n_iov-1].iov_len);
29242925
pc_buf = iov[n_iov-1].iov_base;
29252926
}
29262927

0 commit comments

Comments
 (0)