Re: [PATCH] smb: client: mask server-provided mode to 07777 in modefromsid

Steve French <[email protected]> Thu, 9 Jul 2026 15:53:51 -0500
Newsgroups gmane.linux.kernel.stable,gmane.linux.kernel.cifs,gmane.linux.kernel,gmane.network.samba.internals
Message-ID <CAH2r5mtg=Ko8FMO0dkTw72wu8rVJuC312bQ9QKUyNaL3gf_wbA@mail.gmail.com>
merged into cifs-2.6.git for-next

On Thu, Jul 9, 2026 at 10:55=E2=80=AFAM Bjoern Doebel <[email protected]> wr=
ote:
>
> From: Norbert Manthey <[email protected]>
>
> When modefromsid is active, parse_dacl() applies the server-provided
> sub_auth[2] value from the NFS mode SID to cf_mode without masking to
> 07777. Apply the correct masking, same as in the read path.
>
> Fixes: e2f8fbfb8d09c ("cifs: get mode bits from special sid on stat")
> Signed-off-by: Norbert Manthey <[email protected]>
> Assisted-by: Kiro:claude-opus-4.6
> Cc: [email protected]
> ---
>  fs/smb/client/cifsacl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
> index 6d572dd995d79..a0a68404fbff7 100644
> --- a/fs/smb/client/cifsacl.c
> +++ b/fs/smb/client/cifsacl.c
> @@ -962,7 +962,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *e=
nd_of_acl,
>                                  */
>                                 fattr->cf_mode &=3D ~07777;
>                                 fattr->cf_mode |=3D
> -                                       le32_to_cpu(ppace[i]->sid.sub_aut=
h[2]);
> +                                       le32_to_cpu(ppace[i]->sid.sub_aut=
h[2]) & 07777;
>                                 break;
>                         } else {
>                                 if (compare_sids(&(ppace[i]->sid), powner=
sid) =3D=3D 0) {
> --
> 2.50.1
>
>


--=20
Thanks,

Steve