From patchwork Tue Apr 25 12:03:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gfree.wind@foxmail.com X-Patchwork-Id: 17015 X-Patchwork-Delegate: sven@narfation.org Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 3BD088362E; Tue, 25 Apr 2017 14:47:16 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=foxmail.com Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=foxmail.com header.i=@foxmail.com header.b=adMITcVE; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from smtpbg298.qq.com (smtpbg298.qq.com [184.105.67.102]) by open-mesh.org (Postfix) with ESMTPS id 8AFF483323 for ; Tue, 25 Apr 2017 14:03:47 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=pass header.from=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1493121814; bh=YDC9HEcUDk0UD3YdwEYqoHYIzUN2QJDzXP8VMmEHrBk=; h=From:To:Cc:Subject:Date:Message-Id; b=adMITcVEHUqEM3td2qiw9Ht7z6EwYa2I7fVqiTqA51oLL8wXW86b1pESOuD+eF+bK tMt/OQISzrIWpdmriI4HbNA46F9Vvz7g8uxjcaQK6QZQSHCQ3Tt7eikVAe2N1L77r4 rW4T1UENsw/DtUX83cGf51VqrC5kQZS5FQLCtqk4= X-QQ-mid: esmtp27t1493121808to5bypyr3 Received: from ikuai8.com (unknown [114.242.17.234]) by esmtp4.qq.com (ESMTP) with id ; Tue, 25 Apr 2017 20:03:22 +0800 (CST) X-QQ-SSF: 01000000000000F0FG600F00000000Q X-QQ-FEAT: tZ7SKDDlSpHlk6ZzfJmRlBzOsarw2BL0CsgswP43X7+cfbufV9hmF9wnGEBSP 4cU+pUn2ZJlPjrThLNNWWggOz/Kip5F+Tj7c0hT3McRy+tuE/+FsZuama5/83hyx1Fy7tn2 Pu9r1Y1qgbT1NP6dpVlMwgQA173/5hKkzwciBxbyjnhBnN8WivGEwIZux3mC6Qj80wXTCVe 2DMvhVa3FNK8CRqKfSUfgO1eeEiLJRqiFW0ohBwaoVDS2/5ale49a4Av81bBM19oMR0AvFP HVZrJh8zVvdXar X-QQ-GoodBg: 0 From: gfree.wind@foxmail.com To: mareklindner@neomailbox.ch, sw@simonwunderlich.de, a@unstable.cc, davem@davemloft.net, b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org Date: Tue, 25 Apr 2017 20:03:20 +0800 Message-Id: <1493121800-28066-1-git-send-email-gfree.wind@foxmail.com> X-Mailer: git-send-email 1.9.1 X-QQ-SENDSIZE: 520 X-QQ-FName: C885DE5C534B488BB546C7E5CA355361 X-QQ-LocalIP: 10.130.87.224 X-Mailman-Approved-At: Tue, 25 Apr 2017 14:47:14 +0200 Cc: Gao Feng Subject: [B.A.T.M.A.N.] [PATCH net] net: batman-adv: Fix possible memleaks when fail to register_netdevice X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" From: Gao Feng Because the func batadv_softif_init_late allocate some resources and it would be invoked in register_netdevice. So we need to invoke the func batadv_softif_free instead of free_netdev to cleanup when fail to register_netdevice. Signed-off-by: Gao Feng --- net/batman-adv/soft-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index d042c99..90bf990 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -1011,7 +1011,7 @@ struct net_device *batadv_softif_create(struct net *net, const char *name) if (ret < 0) { pr_err("Unable to register the batman interface '%s': %i\n", name, ret); - free_netdev(soft_iface); + batadv_softif_free(soft_iface); return NULL; }