[PATCH] ksmbd: do not log a stale security descriptor as an error
From: Ian Bridges
Date: Tue Nov 17 2026 - 09:50:22 EST
ksmbd stores a hash of the file's owner, group, mode and POSIX ACLs with
each security descriptor. ksmbd_vfs_get_sd_xattr() recomputes the hash
when it loads the descriptor. If the two differ, the descriptor is stale
and ksmbd treats it as absent. That is expected after a chmod, chown or
setfacl on the server, but the function logs "hash value diff" with
pr_err() every time.
Opens, security queries, hide-unreadable listings and inheritance
can all load stored descriptors. Repeated opens of a file with a
stale descriptor can therefore fill the kernel log.
Report a stale descriptor with ksmbd_debug() instead, and include the
file name in the message.
Signed-off-by: Ian Bridges <icb@xxxxxxxxxxxx>
---
Tested on ksmbd-for-next c1a783037082 with KASAN. Opening a file whose
stored descriptor is stale no longer logs an error. With SMB debugging
on, each open logs the new debug line. smbtorture results match the
base.
This patch was developed with LLM assistance.
fs/smb/server/vfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index 1114f2503ea7..83b0bf783886 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -1829,7 +1829,8 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn,
sha256(acl_ndr.data, acl_ndr.offset, cmp_hash);
if (memcmp(cmp_hash, acl.posix_acl_hash, XATTR_SD_HASH_SIZE)) {
- pr_err("hash value diff\n");
+ ksmbd_debug(SMB, "stored SD of %pd is stale, not used\n",
+ dentry);
rc = -EINVAL;
goto out_free;
}
--
2.47.3