Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb: client: fix zero length for mkdir POSIX create context
@ 2025-04-29 12:59 Jethro Donaldson
  2025-04-29 16:20 ` Steve French
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jethro Donaldson @ 2025-04-29 12:59 UTC (permalink / raw)
  To: linux-cifs; +Cc: sfrench, pc

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. A ksmbd server
rejects such requests and logs "cli req too short" causing mkdir to fail
with "invalid argument" on the client side.

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>
---

Tested as far as mkdir now works as expected.

Patch is against stable tree at v6.14.4 tag (first patch - unsure if I've
correctly done the base-commit thing, sorry).

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 163b8fea47e8..e7118501fdcc 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -2920,6 +2920,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
 		req->CreateContextsOffset = cpu_to_le32(
 			sizeof(struct smb2_create_req) +
 			iov[1].iov_len);
+		le32_add_cpu(&req->CreateContextsLength, iov[n_iov-1].iov_len);
 		pc_buf = iov[n_iov-1].iov_base;
 	}


base-commit: ea061bad207e1ba693b5488ba64c663f7ca03f50
--
2.49.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-04  8:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 12:59 [PATCH] smb: client: fix zero length for mkdir POSIX create context Jethro Donaldson
2025-04-29 16:20 ` Steve French
2025-05-04  8:08   ` Jethro Donaldson
2025-04-29 19:41 ` Paulo Alcantara
2025-04-30  5:49 ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox