From patchwork Mon May 7 13:54:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 157316 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 C8075B6FAA for ; Mon, 7 May 2012 23:55:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756803Ab2EGNzL (ORCPT ); Mon, 7 May 2012 09:55:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57989 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756171Ab2EGNyp (ORCPT ); Mon, 7 May 2012 09:54:45 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q47Dsg18025075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 May 2012 09:54:42 -0400 Received: from redhat.com (vpn-202-170.tlv.redhat.com [10.35.202.170]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id q47DseGf018167; Mon, 7 May 2012 09:54:41 -0400 Date: Mon, 7 May 2012 16:54:47 +0300 From: "Michael S. Tsirkin" To: Ian Campbell Cc: David Miller , "netdev@vger.kernel.org" , "eric.dumazet@gmail.com" Subject: [PATCH RFC 4/6] tun: orphan frags on xmit Message-ID: <248cee8310a8d41b58b988dfea94e75ee79c6647.1336397823.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tun xmit is actually receive of the internal tun socket. Orphan the frags same as we do for normal rx path. Signed-off-by: Michael S. Tsirkin --- drivers/net/tun.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index bb8c72c..1ccbfd0 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -414,6 +414,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) /* Orphan the skb - required as we might hang on to it * for indefinite time. */ + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) + goto drop; skb_orphan(skb); /* Enqueue packet */