]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ipv4: ip_check_defrag should correctly check return value of skb_copy_bits
authorAlexander Drozdov <al.drozdov@gmail.com>
Tue, 17 Feb 2015 10:33:46 +0000 (13:33 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Thu, 12 Mar 2015 16:27:20 +0000 (16:27 +0000)
commit fba04a9e0c869498889b6445fd06cbe7da9bb834 upstream.

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@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
net/ipv4/ip_fragment.c

index ed32313e307c43202a4710c6f5b74e14c19a4c20..022b5f49aab795667c47f83760f162c9c3c0dbfd 100644 (file)
@@ -685,7 +685,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)