summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-10-12mm/damon/sysfs-schemes: read sysfs_filter->addr_range only onceSJ Park
Patch series "mm/damon: move damos filter range arguments validation to core". DAMOS filter range arguments are being validated in the DAMON sysfs interface. Some of those have minor time-of-check to time-of-use (TOCTOU) bugs. In future, other callers might have duplicated validations with similar bugs. Fix the bugs and further refactor the code to move the validation to the core layer. Also add kunit test cases for the validations. Patches 1 and 2 fix the existing TOCTOU bugs. Patches 3 and 4 adds the validation in the core layer. Patch 5 drops the replicated validation in DAMON sysfs interface. Patch 6 further cleanup the code. Patches 7 and 8 extends kunit tests to test the validation. This patch (of 8): DAMON sysfs interface reads the user-provided address range arguments for addr type DAMOS filter twice. Once for validation, and once again for assignments to the variable that will be passed to the core layer. If the user updates the argument in parallel, an invalid address range could be passed to the core layer. Avoid it by doing the assignments first, and then validating the assigned variables before passing those to the core layer. User impact of the bug should be trivial. From the core layer's perspective, the invalid address range is not really invalid. It just works as having a weird address range. No critical issues such as a crash or a leak could happen. And sane users ain't do such parallel arguments update anyway. If they do, such racy behavior is arguably somewhat expected and deserved. That said, there is no reason to keep such races. Link: https://lore.kernel.org/20260914142327.92510-1-sj@kernel.org Link: https://lore.kernel.org/20260914142327.92510-2-sj@kernel.org Fixes: 2f1abcfccd86 ("mm/damon/sysfs-schemes: support address range type DAMOS filter") Signed-off-by: SJ Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: David Gow <davidgow@davidgow.net> Cc: Usama Arif <usamaarif642@gmail.com> Cc: <stable@vger.kernel.org>
2026-10-13smb: client: allocate struct SMB2_sess_data on the stackPaulo Alcantara
SMB2_sess_setup() kzalloc()s struct SMB2_sess_data only to run a synchronous state machine and free it before returning; the object never escapes the function. At 88 bytes it fits comfortably on the stack even under CONFIG_FRAME_WARN=1024, so drop the allocation and its failure path. memzero_explicit() preserves the kfree_sensitive() scrubbing. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: allocate struct sess_data on the stackPaulo Alcantara
CIFS_SessSetup() kzalloc()s struct sess_data only to run a synchronous state machine and free it before returning; the object never escapes the function. At 96 bytes it fits comfortably on the stack even under CONFIG_FRAME_WARN=1024, so drop the allocation and its failure path. memzero_explicit() preserves the kfree_sensitive() scrubbing. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from CIFSSMBRenameOpenFile()Paulo Alcantara
The nls codepage passed to CIFSSMBRenameOpenFile() is always pTcon->ses->local_nls, so derive it from @pTcon and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from SMBLegacyOpen()Paulo Alcantara
The nls codepage passed to SMBLegacyOpen() is always tcon->ses->local_nls, so derive it from @tcon and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from CIFSPOSIXCreate()Paulo Alcantara
The nls codepage passed to CIFSPOSIXCreate() is always tcon->ses->local_nls, so derive it from @tcon and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from CIFSPOSIXDelFile()Paulo Alcantara
The nls codepage passed to CIFSPOSIXDelFile() is always tcon->ses->local_nls, so derive it from @tcon and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from ->tree_connect()Paulo Alcantara
The nls codepage passed to ->tree_connect() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from cifs_setup_session()Paulo Alcantara
The nls codepage passed to cifs_setup_session() is always ses->local_nls and, now that ->sess_setup() no longer takes it, is unused, so drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from ->sess_setup()Paulo Alcantara
The nls codepage threaded through ->sess_setup() and stored in sess_data->nls_cp is always ses->local_nls, so derive it from @ses and drop both the parameter and the now-dead sess_data->nls_cp member. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop unused nls_table arg from decode_ascii_ssetup()Paulo Alcantara
decode_ascii_ssetup() never uses the nls codepage, so drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from decode_unicode_ssetup()Paulo Alcantara
The nls codepage passed to decode_unicode_ssetup() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop unused nls_table arg from ascii_ssetup_strings()Paulo Alcantara
ascii_ssetup_strings() no longer uses the nls codepage, so drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from unicode_ssetup_strings()Paulo Alcantara
The nls codepage passed to unicode_ssetup_strings() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop unused nls_table arg from ascii_domain_string()Paulo Alcantara
ascii_domain_string() never uses the nls codepage, so drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from unicode_domain_string()Paulo Alcantara
The nls codepage passed to unicode_domain_string() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop unused nls_table arg from ascii_oslm_strings()Paulo Alcantara
ascii_oslm_strings() never uses the nls codepage, so drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from build_ntlmssp_auth_blob()Paulo Alcantara
The nls codepage passed to build_ntlmssp_auth_blob() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from ↵Paulo Alcantara
build_ntlmssp_smb3_negotiate_blob() The nls codepage passed to build_ntlmssp_smb3_negotiate_blob() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from build_ntlmssp_negotiate_blob()Paulo Alcantara
The nls codepage passed to build_ntlmssp_negotiate_blob() is always ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from setup_ntlmv2_rsp()Paulo Alcantara
The nls codepage passed to setup_ntlmv2_rsp() is always ses->local_nls, which is never NULL, so derive it from @ses and drop both the parameter and the now-dead NULL check. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from calc_ntlmv2_hash()Paulo Alcantara
The nls codepage passed to calc_ntlmv2_hash() is always ses->local_nls; derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from build_avpair_blob()Paulo Alcantara
The nls codepage passed to build_avpair_blob() is always the session's ses->local_nls, so derive it from @ses and drop the parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from ->set_EA()Paulo Alcantara
The ->set_EA() operation already receives the cifs_sb whose local_nls the callers pass separately, and that is the same table as ses->local_nls (the session match requires an identical iocharset). The SMB2 implementation never used it. Drop the parameter: CIFSSMBSetEA() derives the codepage from tcon->ses->local_nls and smb2_set_ea() no longer takes it. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from CIFSSMBSetPathInfo()Paulo Alcantara
CIFSSMBSetPathInfo() already gets the cifs_sb whose local_nls the caller passes separately as nls_codepage, and that is the same table as tcon->ses->local_nls. Derive it from the session and drop the redundant parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: drop redundant nls_table arg from SMBSetInformation()Paulo Alcantara
SMBSetInformation() already gets the cifs_sb whose local_nls the caller passes separately as nls_codepage, and that is the same table as tcon->ses->local_nls. Derive it from the session and drop the redundant parameter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: size smb2_compound_vars.qi_iov for the padding iovPaulo Alcantara
A non-last, non-encrypted compound request gets an 8-byte alignment padding iov appended by smb2_set_next_command() at rq_iov[rq_nvec]. qi_iov was a single struct kvec used for the query_info link of such chains, so with rq_nvec == 1 the padding was written into the adjacent io_iov[0] member. That write stays within struct smb2_compound_vars and io_iov is unused on the query_info paths, so it is harmless today, but it relies on field ordering and would corrupt a live member if that changed. Add SMB2_QUERY_INFO_IOV_SIZE and make qi_iov an array so the padding iov gets its own slot. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove unused file flags ioctl handlersHuiwen He
FS_IOC_GETFLAGS and FS_IOC_SETFLAGS are now handled by the generic VFS fileattr path, so their cifs_ioctl() handlers are unreachable. Remove the handlers and associated state. Signed-off-by: Huiwen He <hehuiwen@kylinos.cn> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Paulo Alcantara <pc@manguebit.org>
2026-10-13smb: client: implement fileattr_set for compression flagsHuiwen He
CIFS handles FS_IOC_SETFLAGS in cifs_ioctl() because it does not implement ->fileattr_set. This causes the request to fall back from the generic fileattr path and bypass its permission and serialization checks. Implement ->fileattr_set for regular files and directories and use the existing compression helper for FS_COMPR_FL. Accept an unchanged FS_CASEFOLD_FL reported by fileattr_get so chattr can update compression on case-insensitive shares. Tested chattr +c and -c on files and directories against Samba. Non-owner and read-only mount requests were rejected by the VFS checks. Signed-off-by: Huiwen He <hehuiwen@kylinos.cn> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Paulo Alcantara <pc@manguebit.org>
2026-10-13smb: client: remove unused num_acl_set stat from cifs_tconPaulo Alcantara
num_acl_set is only ever reset to 0 -- never incremented or reported -- so drop the dead counter. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove write-only signing_negotiated from TCP_Server_InfoPaulo Alcantara
signing_negotiated is set when a signing context is received but never read; drop it. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove write-only sec_kerberosu2u from TCP_Server_InfoPaulo Alcantara
sec_kerberosu2u is set when the krb5 user-to-user OID is seen but is never read, so the OID branch that sets it has no effect. Drop both. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove write-only max_rw from TCP_Server_InfoPaulo Alcantara
max_rw is assigned from the SMB1 negotiate response but never read, so drop it. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove unused overrideSecFlg from struct cifs_sesPaulo Alcantara
overrideSecFlg has no readers or writers anywhere in the tree; drop it. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove the internal CIFS version numberPaulo Alcantara
CIFS carried a hand-maintained internal version (CIFS_VERSION and SMB3_PRODUCT_BUILD) that had to be bumped by hand on every change. The kernel version already identifies which features and fixes are present, so drop it. Remove MODULE_VERSION() and the "CIFS Version" line in DebugData, and send LINUX_VERSION_SUBLEVEL in the NTLMSSP ProductBuild field so the advertised version is derived entirely from the kernel version -- its major and minor were already taken from there. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: clean up cifs_buf_release()Paulo Alcantara
Remove the leftover commented-out debug message, drop the now-unnecessary braces around the single return, and test !buf_to_free instead of comparing against NULL. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out Unix caps assignmentPaulo Alcantara
Drop this leftover commented-out assignment. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out time conversion debug messagePaulo Alcantara
Drop this leftover commented-out debug message. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out CIFSSMBWinSetPerms() callPaulo Alcantara
Drop this leftover commented-out call. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out QPathInfo debug messagePaulo Alcantara
Drop this leftover commented-out debug message. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out LOCK_RSP declarationPaulo Alcantara
Drop this leftover commented-out declaration. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out write debug messagePaulo Alcantara
Drop this leftover commented-out debug message. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out oplock assignmentPaulo Alcantara
Drop this leftover commented-out assignment. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out cancel_*_requests() callsPaulo Alcantara
Drop these leftover commented-out calls. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out i_flags assignmentPaulo Alcantara
Drop this leftover commented-out assignment. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: remove commented-out ntlmv2_support definitionPaulo Alcantara
Drop this leftover commented-out definition. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: log the selected security type on session setup failurePaulo Alcantara
When mounting without an explicit sec= option, ses->sectype stays Unspecified while the real mechanism is chosen later through ->select_sectype(), so a failed session setup logs a useless name: CIFS: VFS: \\server failed to create a new SMB session with Unknown: -13 Resolve the mechanism through ->select_sectype() before formatting it, as cifs_debug.c already does, so the message names the actual security type. Fixes: a8fce7c807b1 ("smb: client: improve error message when creating SMB session") Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: avoid breaking the file lease when probing mfsymlinksPaulo Alcantara
cifs_check_mf_symlink() probes any file whose size matches CIFS_MF_SYMLINK_FILE_SIZE as a possible Minshall+French symlink. smb2_query_mf_symlink() did so with a fresh leaseless SMB2_open, so the server saw a second conflicting opener and broke the RWH lease the client had just been granted on the same file, needlessly churning the cache. Rework smb2_query_mf_symlink() to issue a single OPEN/READ/CLOSE compound that either reuses an already open handle via cifs_get_readable_path() or, failing that, opens with the inode's lease key so the server treats it as the same lease holder. Thread the inode down to the ->query_mf_symlink() handlers, rename check_mf_symlink() to cifs_check_mf_symlink(), and validate the read payload against the response buffer before copying it. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: set lease_granted before revalidating inode in cifs_nt_open()Paulo Alcantara
cifs_new_fileinfo() -> set_fid() sets CIFS_I(inode)->lease_granted only after cifs_get_inode_info() has run. Opens that cifs_get_inode_info() issues for the inode -- such as the Minshall+French symlink probe or an open compounded in smb2_compound_op() -- therefore find lease_granted clear, go out leaseless, and make the server break the lease just granted to the file. Set lease_granted right after the open succeeds, before cifs_get_inode_info(), so those opens reuse the inode's lease key. Only raise it: lease_granted is kept set for the inode's lifetime, so lowering it here could clobber a lease still held through another open. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>
2026-10-13smb: client: rename mfsymlink helpers to the smb2_ prefixPaulo Alcantara
smb3_query_mf_symlink() and smb3_create_mf_symlink() are installed from smb20_operations through smb311_operations, so they serve every SMB2 dialect rather than only SMB3. Rename them with the smb2_ prefix to match. No functional change. Signed-off-by: Paulo Alcantara <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Shyam Prasad N <sprasad@microsoft.com> Cc: Tom Talpey <tom@talpey.com> Cc: Bharath SM <bharathsm@microsoft.com>