Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbbBSJ1A (ORCPT ); Thu, 19 Feb 2015 04:27:00 -0500 Received: from mail-la0-f51.google.com ([209.85.215.51]:38693 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbbBSJ06 (ORCPT ); Thu, 19 Feb 2015 04:26:58 -0500 From: Alexander Drozdov To: "David S. Miller" , Alexey Kuznetsov , James Morris , ideaki YOSHIFUJI , Patrick McHardy , Eric Dumazet Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Drozdov , Johannes Berg Subject: [RESEND PATCH] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Date: Thu, 19 Feb 2015 12:26:32 +0300 Message-Id: <1424337992-8854-1-git-send-email-al.drozdov@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1147 Lines: 32 skb_copy_bits() returns zero on success and a 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 Acked-by: Eric Dumazet Cc: Johannes Berg --- 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) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/