From bea20b65163500b2192fa10933fbf3a7edd5044a Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Wed, 8 Jul 2026 21:46:16 +0900 Subject: [PATCH] ksmbd: preserve compression state in set basic info FILE_ATTRIBUTE_COMPRESSED is controlled by FSCTL_SET_COMPRESSION and should not be set directly through FileBasicInformation. Keep the existing compression state when updating basic attributes and ignore the compressed bit supplied by the client in the basic information request. Signed-off-by: Namjae Jeon --- fs/smb/server/smb2pdu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index efd67d5c684d..46e492595e87 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -7031,6 +7031,8 @@ static int set_file_basic_info(struct ksmbd_file *fp, struct file *filp; struct inode *inode; struct mnt_idmap *idmap; + __le32 attrs_mask = FILE_ATTRIBUTE_DIRECTORY_LE | + FILE_ATTRIBUTE_COMPRESSED_LE; int rc = 0; if (!(fp->daccess & FILE_WRITE_ATTRIBUTES_LE)) @@ -7068,8 +7070,9 @@ static int set_file_basic_info(struct ksmbd_file *fp, } if (!(S_ISDIR(inode->i_mode) && file_info->Attributes == FILE_ATTRIBUTE_NORMAL_LE)) - fp->f_ci->m_fattr = file_info->Attributes | - (fp->f_ci->m_fattr & FILE_ATTRIBUTE_DIRECTORY_LE); + fp->f_ci->m_fattr = + (file_info->Attributes & ~FILE_ATTRIBUTE_COMPRESSED_LE) | + (fp->f_ci->m_fattr & attrs_mask); } if (test_share_config_flag(share, KSMBD_SHARE_FLAG_STORE_DOS_ATTRS) &&