From patchwork Thu Jun 30 00:08:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sairam Venugopal X-Patchwork-Id: 642268 X-Patchwork-Delegate: guru@ovn.org 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 3rg0K02jkvz9snl for ; Thu, 30 Jun 2016 10:09:24 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 5ECFA106BF; Wed, 29 Jun 2016 17:09:18 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 783B3102A9 for ; Wed, 29 Jun 2016 17:09:17 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id EE6A01E013B for ; Wed, 29 Jun 2016 18:09:16 -0600 (MDT) X-ASG-Debug-ID: 1467245356-09eadd484b9f500001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id bDHqtWDRoVE9DVdH (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 29 Jun 2016 18:09:16 -0600 (MDT) X-Barracuda-Envelope-From: vsairam@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO EX13-EDG-OU-002.vmware.com) (208.91.0.190) by mx1-pf2.cudamail.com with ESMTPS (AES256-SHA encrypted); 30 Jun 2016 00:09:16 -0000 Received-SPF: error (mx1-pf2.cudamail.com: error in processing during lookup of vmware.com: DNS problem) Received: from sc9-mailhost1.vmware.com (10.113.161.71) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Wed, 29 Jun 2016 17:09:08 -0700 Received: from localhost.localdomain (htb-1s-eng-dhcp151.eng.vmware.com [10.33.78.151]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id EDCDE1855D; Wed, 29 Jun 2016 17:09:15 -0700 (PDT) X-CudaMail-Envelope-Sender: vsairam@vmware.com From: Sairam Venugopal To: X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-628092878 X-CudaMail-DTE: 062916 X-CudaMail-Originating-IP: 208.91.0.190 Date: Wed, 29 Jun 2016 17:08:49 -0700 X-ASG-Orig-Subj: [##CM-E2-628092878##][PATCH v4 07/11] datapath-windows: Conntrack - Handle memory allocation failure Message-ID: <1467245333-8112-8-git-send-email-vsairam@vmware.com> X-Mailer: git-send-email 2.5.0.windows.1 In-Reply-To: <1467245333-8112-1-git-send-email-vsairam@vmware.com> References: <1467245333-8112-1-git-send-email-vsairam@vmware.com> MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-002.vmware.com: vsairam@vmware.com does not designate permitted sender hosts) X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1467245356 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 v4 07/11] datapath-windows: Conntrack - Handle memory allocation failure 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: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" Return null if Windows fails to allocate memory for the conntrack entry. Signed-off-by: Sairam Venugopal Acked-by: Paul-Daniel Boca Acked-by: Nithin Raju Acked-by: Nithin Raju --- datapath-windows/ovsext/Conntrack-other.c | 5 +++-- datapath-windows/ovsext/Conntrack-tcp.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/datapath-windows/ovsext/Conntrack-other.c b/datapath-windows/ovsext/Conntrack-other.c index 5d39389..b853020 100644 --- a/datapath-windows/ovsext/Conntrack-other.c +++ b/datapath-windows/ovsext/Conntrack-other.c @@ -73,8 +73,9 @@ OvsConntrackCreateOtherEntry(UINT64 now) struct conn_other *conn; conn = OvsAllocateMemoryWithTag(sizeof(struct conn_other), OVS_CT_POOL_TAG); - /* XXX Handle memory allocation error (by returning a status) */ - ASSERT(conn); + if (!conn) { + return NULL; + } conn->up = (OVS_CT_ENTRY) {0}; conn->state = OTHERS_FIRST; OvsConntrackUpdateExpiration(conn, now); diff --git a/datapath-windows/ovsext/Conntrack-tcp.c b/datapath-windows/ovsext/Conntrack-tcp.c index 1d60323..a0ee791 100644 --- a/datapath-windows/ovsext/Conntrack-tcp.c +++ b/datapath-windows/ovsext/Conntrack-tcp.c @@ -490,6 +490,10 @@ OvsConntrackCreateTcpEntry(const TCPHdr *tcp, newconn = OvsAllocateMemoryWithTag(sizeof(struct conn_tcp), OVS_CT_POOL_TAG); + if (!newconn) { + return NULL; + } + newconn->up = (OVS_CT_ENTRY) {0}; src = &newconn->peer[0]; dst = &newconn->peer[1];