summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAlexander Drozdov <al.drozdov@gmail.com>2015-02-17 13:33:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-18 13:31:21 +0100
commit0b04f65d11c1889908fd7594cbd015bcd2c640dd (patch)
treee46d74040f7af57bdce36fb186f7a4e756c1c70b /net
parentf1796b116e46cd8c341e9b08d8aa1f3d5cc6f818 (diff)
ipv4: ip_check_defrag should correctly check return value of skb_copy_bits
[ Upstream commit fba04a9e0c869498889b6445fd06cbe7da9bb834 ] 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_fragment.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index c10a3ce5cbff..95d030adb17d 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -684,7 +684,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)