From patchwork Sat Aug 4 06:54:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 175075 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 06F9A2C0080 for ; Sat, 4 Aug 2012 16:54:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753445Ab2HDGyY (ORCPT ); Sat, 4 Aug 2012 02:54:24 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:35448 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090Ab2HDGyT (ORCPT ); Sat, 4 Aug 2012 02:54:19 -0400 Received: by wgbfm10 with SMTP id fm10so173332wgb.1 for ; Fri, 03 Aug 2012 23:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=in/YB9TAMFxZvqiEl6Tv0yUISfQWf3FbK/O9/BjkXVk=; b=mvefJGNsDo66xok/FNRedNK3FjdhSWaMMGVPzQE/h2mCyr7FHHn9uC3mZZYKCxihca unVrVW5qgbyj+mD+oi4ZaM0bxR2YRgmMgpQaSSws3NUYQJ1m91UGDUPSNlqNDcqm+T4M m+PXpVhYsEL81lUA8X7aSmZ0I1HX/YJtGzHaKXVMskFpNEE9BRNqX9pyWsd5WXSOr+2T eMxDfLenCQO/Y1n/cd8a6TuUHOgu/UDoqoJRVLS8InMqAT5hrvtMQacPzn+3cW58oepg TYcAUfIaTbI12XdJ3nrF64uiXxr2S6+kdvnKsNHXXRwtl2Ppuhj2/u4o1UeUq46I21fS MkMQ== Received: by 10.180.97.106 with SMTP id dz10mr2342266wib.21.1344063258576; Fri, 03 Aug 2012 23:54:18 -0700 (PDT) Received: from [172.30.42.18] (171.237.66.86.rev.sfr.net. [86.66.237.171]) by mx.google.com with ESMTPS id el6sm1429557wib.8.2012.08.03.23.54.16 (version=SSLv3 cipher=OTHER); Fri, 03 Aug 2012 23:54:17 -0700 (PDT) Subject: [PATCH net-next] net: skb_share_check() should use consume_skb() From: Eric Dumazet To: David Miller Cc: netdev Date: Sat, 04 Aug 2012 08:54:15 +0200 Message-ID: <1344063255.9299.1457.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet In order to avoid false drop_monitor indications, we should call consume_skb() if skb_clone() was successful. Signed-off-by: Eric Dumazet --- include/linux/skbuff.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 7632c87..b33a3a1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -846,13 +846,16 @@ static inline int skb_shared(const struct sk_buff *skb) * * NULL is returned on a memory allocation failure. */ -static inline struct sk_buff *skb_share_check(struct sk_buff *skb, - gfp_t pri) +static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri) { might_sleep_if(pri & __GFP_WAIT); if (skb_shared(skb)) { struct sk_buff *nskb = skb_clone(skb, pri); - kfree_skb(skb); + + if (likely(nskb)) + consume_skb(skb); + else + kfree_skb(skb); skb = nskb; } return skb;