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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhQdN571U3-xGpMc44uwkwTayQ5n-yqvouF7q=VurtcS9g@mail.gmail.com>
Date:   Fri, 21 Feb 2020 16:18:00 -0500
From:   Paul Moore <paul@...l-moore.com>
To:     Matteo Croce <mcroce@...hat.com>
Cc:     netdev@...r.kernel.org, linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Alexey Kuznetsov <kuznet@....inr.ac.ru>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Guillaume Nault <gnault@...hat.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net] ipv4: ensure rcu_read_lock() in cipso_v4_error()

On Fri, Feb 21, 2020 at 6:28 AM Matteo Croce <mcroce@...hat.com> wrote:
>
> Similarly to commit c543cb4a5f07 ("ipv4: ensure rcu_read_lock() in
> ipv4_link_failure()"), __ip_options_compile() must be called under rcu
> protection.
>
> Fixes: 3da1ed7ac398 ("net: avoid use IPCB in cipso_v4_error")
> Suggested-by: Guillaume Nault <gnault@...hat.com>
> Signed-off-by: Matteo Croce <mcroce@...hat.com>
> ---
>  net/ipv4/cipso_ipv4.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

This seems consistent with the ipv4_link_failure() fix, even though
ipv4_link_failure() has changed a bit since the fix.

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

> diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
> index 376882215919..0bd10a1f477f 100644
> --- a/net/ipv4/cipso_ipv4.c
> +++ b/net/ipv4/cipso_ipv4.c
> @@ -1724,6 +1724,7 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
>  {
>         unsigned char optbuf[sizeof(struct ip_options) + 40];
>         struct ip_options *opt = (struct ip_options *)optbuf;
> +       int res;
>
>         if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES)
>                 return;
> @@ -1735,7 +1736,11 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
>
>         memset(opt, 0, sizeof(struct ip_options));
>         opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
> -       if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL))
> +       rcu_read_lock();
> +       res = __ip_options_compile(dev_net(skb->dev), opt, skb, NULL);
> +       rcu_read_unlock();
> +
> +       if (res)
>                 return;
>
>         if (gateway)
> --
> 2.24.1

-- 
paul moore
www.paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ