[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1424188529.4942.80.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Tue, 17 Feb 2015 07:55:29 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Alexander Drozdov <al.drozdov@...il.com>,
Johannes Berg <johannes.berg@...el.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
James Morris <jmorris@...ei.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Patrick McHardy <kaber@...sh.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ipv4: ip_check_defrag should correctly check return
value of skb_copy_bits
On Tue, 2015-02-17 at 13:33 +0300, Alexander Drozdov wrote:
> skb_copy_bits() returns zero on success and negative value on error,
> so it is needed to invert the condition in ip_check_defrag().
>
> Fixes: 1bf3751ec90c ("ipv4: ip_check_defrag must not modify skb before unsharing")
> Signed-off-by: Alexander Drozdov <al.drozdov@...il.com>
> ---
> net/ipv4/ip_fragment.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
> index e5b6d0d..2c8d98e 100644
> --- a/net/ipv4/ip_fragment.c
> +++ b/net/ipv4/ip_fragment.c
> @@ -664,7 +664,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
> if (skb->protocol != htons(ETH_P_IP))
> return skb;
>
> - if (!skb_copy_bits(skb, 0, &iph, sizeof(iph)))
> + if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0)
> return skb;
>
> if (iph.ihl < 5 || iph.version != 4)
Thanks, I wonder how this was not found/fixed earlier.
Acked-by: Eric Dumazet <edumazet@...gle.com>
Cc: Johannes Berg <johannes.berg@...el.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists