]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: use unaligned reads in parse_posix_ctxt()
authorZihan Xi <xizh2024@lzu.edu.cn>
Wed, 1 Jul 2026 10:23:21 +0000 (18:23 +0800)
committerSteve French <stfrench@microsoft.com>
Thu, 2 Jul 2026 01:19:18 +0000 (20:19 -0500)
The server controls create-context DataOffset, so the POSIX context data
pointer may be misaligned on strict-alignment architectures. Use
get_unaligned_le32() when reading nlink, reparse_tag, and mode.

Fixes: 69dda3059e7a ("cifs: add SMB2_open() arg to return POSIX data")
Cc: stable@vger.kernel.org
Signed-off-by: Zihan Xi <xizh2024@lzu.edu.cn>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2pdu.c

index 77738900e75e20eb362d63890e848c060c2315a8..95c0efe9d43b1f355c01160ebeb2196069042dc1 100644 (file)
@@ -2396,9 +2396,9 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
 
        memset(posix, 0, sizeof(*posix));
 
-       posix->nlink = le32_to_cpu(*(__le32 *)(beg + 0));
-       posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
-       posix->mode = le32_to_cpu(*(__le32 *)(beg + 8));
+       posix->nlink = get_unaligned_le32(beg);
+       posix->reparse_tag = get_unaligned_le32(beg + 4);
+       posix->mode = get_unaligned_le32(beg + 8);
 
        sid = beg + 12;
        sid_len = posix_info_sid_size(sid, end);