From patchwork Fri Oct 14 14:12:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 682288 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3swV0k3CPDz9s2G for ; Sat, 15 Oct 2016 01:12:22 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 77C2A1069C; Fri, 14 Oct 2016 07:12:21 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 8CDB210658 for ; Fri, 14 Oct 2016 07:12:20 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 1AA87162961 for ; Fri, 14 Oct 2016 08:12:20 -0600 (MDT) X-ASG-Debug-ID: 1476454338-0b32373755093e0001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar6.cudamail.com with ESMTP id C6YZYC6zDTydhhtZ (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 14 Oct 2016 08:12:18 -0600 (MDT) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx3-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 14 Oct 2016 14:12:18 -0000 Received-SPF: pass (mx3-pf2.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8EECB891D for ; Fri, 14 Oct 2016 14:12:17 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-116-111.phx2.redhat.com [10.3.116.111]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9EECGPV027107; Fri, 14 Oct 2016 10:12:16 -0400 X-CudaMail-Envelope-Sender: cascardo@redhat.com From: Thadeu Lima de Souza Cascardo To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-1013013118 X-CudaMail-DTE: 101416 X-CudaMail-Originating-IP: 209.132.183.28 Date: Fri, 14 Oct 2016 11:12:06 -0300 X-ASG-Orig-Subj: [##CM-V2-1013013118##][PATCH] tnl-ports: fix missing netdev_close Message-Id: <1476454326-22763-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 14 Oct 2016 14:12:17 +0000 (UTC) X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1476454338 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH] tnl-ports: fix missing netdev_close X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" There were leaks on netdev_close references. Whenever an address was removed from an interface, it was possible that a race would make the netlink message be processed and no address be found on the interface, causing insert_ipdev to bail out. When that happened, the netdev would be left opened as type system, and when adding an interface with the same name as type internal, even though the system interface was already gone, netdev_open would return the one with type system. And, then, no internal interface would be created. Tested-by: Aaron Conole Signed-off-by: Thadeu Lima de Souza Cascardo --- So, Aaron found out that applying the following commits would fix a bug in branch 2.5, but we considered that would be too much. So, after some investigation, we realized that the change below fixes the issue, as described above. So, we would like to see this applied to branch 2.5, instead of doing a backport for a larger change. 2b02db1 packets: Add new functions for IPv4 and IPv6 address parsing. a8704b5 tunneling: Handle multiple ip address for given device. 3e6dc8b netdev: Verify ifa_addr is not NULL when iterating over getifaddrs. c2a1cee route-table: flush addresses list when route table is reset --- lib/tnl-ports.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c index e7f2066..bcf4b94 100644 --- a/lib/tnl-ports.c +++ b/lib/tnl-ports.c @@ -368,12 +368,14 @@ insert_ipdev(const char dev_name[]) ip_dev->change_seq = netdev_get_change_seq(dev); error = netdev_get_etheraddr(ip_dev->dev, &ip_dev->mac); if (error) { + netdev_close(dev); free(ip_dev); return; } error4 = netdev_get_in4(ip_dev->dev, (struct in_addr *)&ip_dev->addr4, NULL); error6 = netdev_get_in6(ip_dev->dev, &ip_dev->addr6); if (error4 && error6) { + netdev_close(dev); free(ip_dev); return; }