Re: [PATCH 3/3] smb: client: use unaligned read for POSIX info name length

Steve French <[email protected]>
Newsgroups org.kernel.vger.linux-cifs
Message-ID <CAH2r5mthz8f_ASpFONw7X9L2mA--HSPT13+gmcm+cdzBW8Dbyw@mail.gmail.com>
owner sid sizes are variable but they look like always a multiple of 4
so should be aligned already, right?

See posix_info_sid_size() function

On Wed, Jul 1, 2026 at 5:26 AM Ren Wei <[email protected]> wrote:
>
> From: Zihan Xi <[email protected]>
>
> posix_info_parse() reads the trailing name length via an aligned le32
> cast at beg + total_len. Owner and group SID sizes are variable, so
> that offset may be misaligned on strict-alignment architectures.
>
> Fixes: 349e13ad30b4 ("cifs: add smb2 POSIX info level")
> Cc: [email protected]
> Signed-off-by: Zihan Xi <[email protected]>
> Signed-off-by: Ren Wei <[email protected]>
> ---
>  fs/smb/client/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
> index ed782d219d55..43d514ee555d 100644
> --- a/fs/smb/client/smb2pdu.c
> +++ b/fs/smb/client/smb2pdu.c
> @@ -5450,7 +5450,7 @@ int posix_info_parse(const void *beg, const void *end,
>         /* check name len */
>         if (beg + total_len + 4 > end)
>                 return -1;
> -       name_len = le32_to_cpu(*(__le32 *)(beg + total_len));
> +       name_len = get_unaligned_le32((u8 *)beg + total_len);
>         if (name_len < 1 || name_len > 0xFFFF)
>                 return -1;
>         total_len += 4;
> --
> 2.43.0
>
>


-- 
Thanks,

Steve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.