From patchwork Mon Dec 9 06:27:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "fan.du" X-Patchwork-Id: 298939 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 DE0612C00A6 for ; Mon, 9 Dec 2013 17:28:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932190Ab3LIG2G (ORCPT ); Mon, 9 Dec 2013 01:28:06 -0500 Received: from mail.windriver.com ([147.11.1.11]:59176 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932354Ab3LIG2E (ORCPT ); Mon, 9 Dec 2013 01:28:04 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail.windriver.com (8.14.5/8.14.5) with ESMTP id rB96S0db022295 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Sun, 8 Dec 2013 22:28:00 -0800 (PST) Received: from [128.224.162.161] (128.224.162.161) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.2.347.0; Sun, 8 Dec 2013 22:28:00 -0800 Message-ID: <52A562EB.9050606@windriver.com> Date: Mon, 9 Dec 2013 14:27:55 +0800 From: Fan Du User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: David Miller CC: , Eric Dumazet Subject: [PATCHv2 net] vxlan: release rt when found circular route References: <1386230631-2504-1-git-send-email-fan.du@windriver.com> <20131206.151407.756289328683473825.davem@davemloft.net> In-Reply-To: <20131206.151407.756289328683473825.davem@davemloft.net> X-Originating-IP: [128.224.162.161] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2013年12月07日 04:14, David Miller wrote: > From: Fan Du > Date: Thu, 5 Dec 2013 16:03:51 +0800 > >> Otherwise causing dst memory leakage. >> Have Checked all other type tunnel device transmit implementation, >> no such things happens anymore. >> >> Signed-off-by: Fan Du > ... >> @@ -1665,6 +1665,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, >> } >> >> if (rt->dst.dev == dev) { >> + ip_rt_put(rt); >> netdev_dbg(dev, "circular route to %pI4\n", >> &dst->sin.sin_addr.s_addr); >> dev->stats.collisions++; > > There is already a "rt_tx_error" label that will handle releasing the > 'rt', so at the end of this basic block, goto rt_tx_error instead of > just plain tx_error. My first thought is using rt_tx_error indeed :), but second thought is this might criticized by being ugly. Anyway please review. From 8867cb9783511a1c945a087209484f74de912689 Mon Sep 17 00:00:00 2001 From: Fan Du Date: Mon, 9 Dec 2013 10:33:53 +0800 Subject: [PATCHv2 net] vxlan: release rt when found circular route Otherwise causing dst memory leakage. Have Checked all other type tunnel device transmit implementation, no such things happens anymore. Signed-off-by: Fan Du Acked-by: Eric Dumazet --- v2: use rt_tx_error label to release rt. --- drivers/net/vxlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 0358c07..249e01c 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1668,7 +1668,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, netdev_dbg(dev, "circular route to %pI4\n", &dst->sin.sin_addr.s_addr); dev->stats.collisions++; - goto tx_error; + goto rt_tx_error; } /* Bypass encapsulation if the destination is local */