lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHC9VhQy2Z512Qy2EVaoc_XMewS0bhH12VJU0SxgK3pSy0ub8Q@mail.gmail.com>
Date:   Fri, 5 Mar 2021 11:42:33 -0500
From:   Paul Moore <paul@...l-moore.com>
To:     Sergey Nazarov <s-nazarov@...dex.ru>
Cc:     linux-security-module@...r.kernel.org, davem@...emloft.net,
        netdev@...r.kernel.org, Ondrej Mosnacek <omosnace@...hat.com>
Subject: Re: [PATCH v2] CIPSO: Fix unaligned memory access in cipso_v4_gentag_hdr

On Fri, Mar 5, 2021 at 3:05 AM Sergey Nazarov <s-nazarov@...dex.ru> wrote:
>
> We need to use put_unaligned when writing 32-bit DOI value
> in cipso_v4_gentag_hdr to avoid unaligned memory access.
>
> v2: unneeded type cast removed as Ondrej Mosnacek suggested.
>
> Signed-off-by: Sergey Nazarov <s-nazarov@...dex.ru>
> ---
>  net/ipv4/cipso_ipv4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Paul Moore <paul@...l-moore.com>

> diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
> index 471d33a..6e59902 100644
> --- a/net/ipv4/cipso_ipv4.c
> +++ b/net/ipv4/cipso_ipv4.c
> @@ -1162,7 +1162,7 @@ static void cipso_v4_gentag_hdr(const struct
> cipso_v4_doi *doi_def,
>  {
>         buf[0] = IPOPT_CIPSO;
>         buf[1] = CIPSO_V4_HDR_LEN + len;
> -       *(__be32 *)&buf[2] = htonl(doi_def->doi);
> +       put_unaligned_be32(doi_def->doi, &buf[2]);
>  }
>
>  /**
> --
> 1.8.3.1

-- 
paul moore
www.paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ