Commit c0c6450b authored by Alexander Drozdov's avatar Alexander Drozdov Committed by Jiri Slaby

ipv4: ip_check_defrag should correctly check return value of skb_copy_bits

[ Upstream commit fba04a9e ]

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: 1bf3751e ("ipv4: ip_check_defrag must not modify skb before unsharing")
Signed-off-by: default avatarAlexander Drozdov <al.drozdov@gmail.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 85320d5d
...@@ -683,7 +683,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) ...@@ -683,7 +683,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
if (skb->protocol != htons(ETH_P_IP)) if (skb->protocol != htons(ETH_P_IP))
return skb; return skb;
if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0)
return skb; return skb;
if (iph.ihl < 5 || iph.version != 4) if (iph.ihl < 5 || iph.version != 4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment