Re: [PATCH 1/2] smb: client: fix off-by-8 bounds check in check_wsl_eas()

ChenXiaoSong <[email protected]> Thu, 9 Apr 2026 11:09:47 +0800
Newsgroups gmane.linux.kernel,gmane.linux.kernel.cifs,gmane.network.samba.internals,gmane.linux.kernel.stable
Message-ID <[email protected]>
Hi Steve,

Should we use `get_unaligned_le32()` to get unaligned data?

> static inline kuid_t wsl_make_kuid(struct cifs_sb_info *cifs_sb,
>                                    void *ptr)                   
> {                                                               
>         u32 uid = le32_to_cpu(*(__le32 *)ptr);
>         ...
> }                                                               


> 
> Additionally, does parsing these extended attributes cause unaligned memory
> accesses?
> When parsing WSL extended attributes, the code derives the value pointer
> at an offset of ea_name_length (which is 6) plus 1 from ea_data. Since
> ea is a 4-byte aligned structure, the value sits at an unaligned offset.
> Helper functions like wsl_make_kuid() explicitly cast this unaligned
> pointer to a 32-bit type and dereference it:
>     le32_to_cpu(*(__le32 *)v);
>     
> Could this trigger an unaligned access exception and crash the kernel on
> architectures with strict alignment requirements?

-- 
ChenXiaoSong <[email protected]>
Chinese Homepage: chenxiaosong.com
English Homepage: chenxiaosong.com/en