[PATCH 05/15] ksmbd: take mount write access for CREATE EAs

Ze Tan <[email protected]> Fri, 24 Jul 2026 18:39:59 +0800
Newsgroups org.kernel.vger.linux-cifs
Message-ID <f31f287cf176b031c2159b33f85d97cccc97952a.1784888897.git.tanze@kylinos.cn>
smb2_open() applies EAs from an SMB2 CREATE context after creating the
path, but calls smb2_set_ea() without requesting mount write access.
The SET_INFO path already requests it before the same VFS xattr
operations.

Pass get_write=true for CREATE-context EAs so setxattr and removexattr
run with mount write access in both paths.

Signed-off-by: Ze Tan <[email protected]>
---
 fs/smb/server/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 39a72cda6704..dd707f67378b 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3694,7 +3694,7 @@ int smb2_open(struct ksmbd_work *work)
 
 			rc = smb2_set_ea(&ea_buf->ea,
 					 le32_to_cpu(ea_buf->ccontext.DataLength),
-					 &path, false);
+					 &path, true);
 			if (rc == -EOPNOTSUPP)
 				rc = 0;
 			else if (rc)
-- 
2.43.0