From patchwork Tue Jun 11 12:09:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1113758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45NTMG55S3z9sDB for ; Tue, 11 Jun 2019 22:09:29 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id ABE95E3C; Tue, 11 Jun 2019 12:09:26 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6CFDCE2A for ; Tue, 11 Jun 2019 12:09:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 16EFF711 for ; Tue, 11 Jun 2019 12:09:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 934CE8666F; Tue, 11 Jun 2019 12:09:24 +0000 (UTC) Received: from dceara.remote.csb (ovpn-117-168.ams2.redhat.com [10.36.117.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DE016149A; Tue, 11 Jun 2019 12:09:23 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Tue, 11 Jun 2019 14:09:20 +0200 Message-Id: <1560254960-18363-1-git-send-email-dceara@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 12:09:24 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovn-controller: Cleanup memory in binding_evaluate_port_binding_changes X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The 'lport_to_iface' and 'egress_ifaces' hashtables were not cleaned up in case a port binding was found that would require a recompute. Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2019-June/048822.html Reported-by: Daniel Alvarez Sanchez Fixes: 9d0b504abdee ("ovn-controller: runtime_data change handler for SB port-binding") CC: Han Zhou Signed-off-by: Dumitru Ceara Acked-by: Han Zhou --- ovn/controller/binding.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c index b62b3da..87d0b6d 100644 --- a/ovn/controller/binding.c +++ b/ovn/controller/binding.c @@ -695,6 +695,8 @@ binding_evaluate_port_binding_changes( return true; } + bool changed = false; + const struct sbrec_port_binding *binding_rec; struct shash lport_to_iface = SHASH_INITIALIZER(&lport_to_iface); struct sset egress_ifaces = SSET_INITIALIZER(&egress_ifaces); @@ -718,10 +720,14 @@ binding_evaluate_port_binding_changes( || is_our_chassis(chassis_rec, binding_rec, active_tunnels, &lport_to_iface, local_lports) || strcmp(binding_rec->type, "")) { - return true; + changed = true; + break; } } - return false; + + shash_destroy(&lport_to_iface); + sset_destroy(&egress_ifaces); + return changed; } /* Returns true if the database is all cleaned up, false if more work is