SET_INFO reports success even when ksmbd cannot store the new security descriptor. The old descriptor has already been removed, so the file falls back to POSIX permissions. Deny ACEs in the new descriptor are lost. This can happen when the descriptor exceeds the filesystem's xattr capacity. Return the storage error to the client. Report -E2BIG as STATUS_DISK_FULL, like -ENOSPC and -EFBIG, and report -ENOMEM as STATUS_INSUFFICIENT_RESOURCES. Both errors previously fell through to STATUS_INVALID_INFO_CLASS. These mappings apply to all SET_INFO classes. Preserve success for filesystems that do not support the xattr. Also preserve the best-effort store for CREATE, where the file has already been created. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges --- Since v1 - Handle -ENOMEM and -E2BIG as requested by Namjae Jeon. Use STATUS_INSUFFICIENT_RESOURCES and STATUS_DISK_FULL, respectively. A failed SET_INFO can still leave partial changes. The owner, group, mode and POSIX ACL updates happen before the store, as does the removal of the old descriptor. This patch reports the failure without rolling back those changes. Tested on ksmbd-for-next 267029b35ad1 with KASAN. A DACL too large for the tested ext4 filesystem now produces STATUS_DISK_FULL. Injected allocation failure produces STATUS_INSUFFICIENT_RESOURCES. A test build that substitutes -E2BIG for the store's -ENOSPC also produces STATUS_DISK_FULL. Small descriptors and filesystems without xattr support behave as before. CREATE still succeeds if storing its descriptor fails. smbtorture results match the base. This patch was developed with LLM assistance. v1: https://lore.kernel.org/linux-cifs/20261118155521.70611-1-icb@fastmail.org/ fs/smb/server/smb2pdu.c | 4 +++- fs/smb/server/smbacl.c | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 29750970f8da..3382974df8d1 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -9526,8 +9526,10 @@ int smb2_set_info(struct ksmbd_work *work) rsp->hdr.Status = STATUS_EA_LIST_INCONSISTENT; else if (rc == -EMSGSIZE) rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH; - else if (rc == -ENOSPC || rc == -EFBIG) + else if (rc == -ENOSPC || rc == -EFBIG || rc == -E2BIG) rsp->hdr.Status = STATUS_DISK_FULL; + else if (rc == -ENOMEM) + rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES; else if (rc == -ESHARE) rsp->hdr.Status = STATUS_SHARING_VIOLATION; else if (rc == -ENOENT) diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c index a87c22fa9a6e..3770dda2b3ed 100644 --- a/fs/smb/server/smbacl.c +++ b/fs/smb/server/smbacl.c @@ -1984,7 +1984,14 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, if (test_share_config_flag(tcon->share_conf, KSMBD_SHARE_FLAG_ACL_XATTR)) { /* Update WinACL in xattr */ ksmbd_vfs_remove_sd_xattrs(idmap, path); - ksmbd_vfs_set_sd_xattr(conn, idmap, path, pntsd, ntsd_len); + rc = ksmbd_vfs_set_sd_xattr(conn, idmap, path, pntsd, ntsd_len); + /* + * The CREATE context (type_check) stays best effort because + * the file exists already. A filesystem without the xattr is + * not an error either. + */ + if (type_check || rc == -EOPNOTSUPP) + rc = 0; } out: -- 2.47.3