From: Ian Bridges <icb@fastmail.org>
To: linkinjeon@kernel.org
Cc: senozhatsky@chromium.org, tom@talpey.com,
chenxiaosong@chenxiaosong.com, linux-cifs@vger.kernel.org,
linux-kernel@vger.kernel.org, Ian Bridges <icb@fastmail.org>,
stable@vger.kernel.org
Subject: [PATCH] ksmbd: check the ACEs after an NFS mode ACE in a DACL
Date: Fri, 20 Nov 2026 10:34:36 -0600 [thread overview]
Message-ID: <20261120163436.15296-1-icb@fastmail.org> (raw)
An allow ACE with SID S-1-5-88-3-<mode> supplies the POSIX mode
directly, and parse_dacl() stops walking the ACEs at the first one.
The same walk checks each ACE and maps its generic rights, so the ACEs
after the NFS mode ACE are neither checked nor mapped. set_info_sec()
still stores the entire DACL and the request succeeds, but part of
that DACL can have no effect.
Continue checking the remaining ACEs and mapping their generic rights,
while preserving the mode from the first NFS mode ACE.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
---
Without this patch, an ACE allowing GENERIC_READ after the NFS mode
ACE grants no access, because the right stays unmapped. A malformed
ACE after the NFS mode ACE is stored instead of being refused. The
access check and QUERY stop at it, so the ACEs after it are neither
applied nor returned.
Tested on ksmbd-for-next 2ef9bd9fa819 with KASAN. CREATE now rejects a
malformed ACE after an NFS mode ACE with STATUS_INVALID_PARAMETER.
GENERIC_READ in a later ACE is stored as the mapped rights, 0x120089,
and now grants read access. Other tested descriptors are stored
unchanged, and smbtorture results match the base.
This patch was developed with LLM assistance.
fs/smb/server/smbacl.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index 58b74b95246e..7bb28ea195c8 100644
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -401,6 +401,7 @@ static int parse_dacl(const struct mnt_idmap *idmap,
struct posix_acl_state acl_state, default_acl_state;
umode_t mode = 0, acl_mode;
bool owner_found = false, group_found = false, others_found = false;
+ bool nfs_mode_found = false;
if (!pdacl)
return 0;
@@ -479,13 +480,17 @@ static int parse_dacl(const struct mnt_idmap *idmap,
ppace[i]->access_req =
smb_map_generic_desired_access(ppace[i]->access_req);
+ /* ACEs after an NFS mode ACE do not change the POSIX mapping */
+ if (nfs_mode_found)
+ continue;
+
if (ppace[i]->type == ACCESS_ALLOWED &&
ppace[i]->sid.num_subauth >= 3 &&
!(compare_sids(&ppace[i]->sid, &sid_unix_NFS_mode))) {
fattr->cf_mode =
le32_to_cpu(ppace[i]->sid.sub_auth[2]);
fattr->cf_posix_mode = true;
- break;
+ nfs_mode_found = true;
} else if (!compare_sids(&ppace[i]->sid, pownersid)) {
acl_mode = access_flags_to_mode(fattr,
ppace[i]->access_req,
--
2.47.3
reply other threads:[~2026-11-20 16:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120163436.15296-1-icb@fastmail.org \
--to=icb@fastmail.org \
--cc=chenxiaosong@chenxiaosong.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=stable@vger.kernel.org \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®