From patchwork Tue Sep 1 13:33:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alin Serdean X-Patchwork-Id: 512828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 8005314076A for ; Tue, 1 Sep 2015 23:34:59 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 852CC10711; Tue, 1 Sep 2015 06:34:58 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 751381070F for ; Tue, 1 Sep 2015 06:34:56 -0700 (PDT) Received: from bar2.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 69E3C420403 for ; Tue, 1 Sep 2015 07:34:55 -0600 (MDT) X-ASG-Debug-ID: 1441114493-03dc53680a07050001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar2.cudamail.com with ESMTP id GbZvpD8oQTb1rKJ7 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 01 Sep 2015 07:34:53 -0600 (MDT) X-Barracuda-Envelope-From: aserdean@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx1-pf1.cudamail.com with SMTP; 1 Sep 2015 13:34:52 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id AACD6402CB for ; Tue, 1 Sep 2015 16:34:51 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OrgtghKFET4y for ; Tue, 1 Sep 2015 16:34:31 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 892733FFB7 for ; Tue, 1 Sep 2015 16:33:58 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0224.002; Tue, 1 Sep 2015 15:33:58 +0200 X-CudaMail-Envelope-Sender: aserdean@cloudbasesolutions.com From: Alin Serdean To: Sorin Vinturis , "dev@openvswitch.org" X-CudaMail-MID: CM-E1-831019665 X-CudaMail-DTE: 090115 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [PATCH] datapath-windows: Proper cleanup in case of driver init failure X-ASG-Orig-Subj: [##CM-E1-831019665##]RE: [PATCH] datapath-windows: Proper cleanup in case of driver init failure Thread-Index: AQHQ5LAF22H2mfHQQkW4+pH7lOdjV54nrD/A Date: Tue, 1 Sep 2015 13:33:57 +0000 Message-ID: <6FDA0CACF4BC624BBE12167875D71C9B9F0A10@CBSEX1.cloudbase.local> References: <1441084528-8191-1-git-send-email-svinturis@cloudbasesolutions.com> In-Reply-To: <1441084528-8191-1-git-send-email-svinturis@cloudbasesolutions.com> Accept-Language: en-US, it-IT Content-Language: ro-RO X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.142858 p=-0.5 Source Normal X-MessageSniffer-Rules: 0-0-0-4344-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1441114493 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 2.11 X-Barracuda-Spam-Status: No, SCORE=2.11 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC0_SA_TO_FROM_DOMAIN_MATCH, BSF_SC7_SA_HREF_FROM_MISMATCH_TEXT_URIx1_HL, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22119 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.01 BSF_SC0_SA_TO_FROM_DOMAIN_MATCH Sender Domain Matches Recipient Domain 2.00 BSF_SC7_SA_HREF_FROM_MISMATCH_TEXT_URIx1_HL Custom Rule HREF_FROM_MISMATCH_TEXT_URIx1_HL Subject: Re: [ovs-dev] [PATCH] datapath-windows: Proper cleanup in case of driver init 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" Acked-by: Alin Gabriel Serdean -----Mesaj original----- De la: dev [mailto:dev-bounces@openvswitch.org] În numele Sorin Vinturis Trimis: Tuesday, September 1, 2015 3:16 PM Către: dev@openvswitch.org Subiect: [ovs-dev] [PATCH] datapath-windows: Proper cleanup in case of driver init failure Signed-off-by: Sorin Vinturis --- datapath-windows/ovsext/Driver.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) -- 1.9.0.msysgit.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev diff --git a/datapath-windows/ovsext/Driver.c b/datapath-windows/ovsext/Driver.c index 13fcde2..853886e 100644 --- a/datapath-windows/ovsext/Driver.c +++ b/datapath-windows/ovsext/Driver.c @@ -139,18 +139,26 @@ DriverEntry(PDRIVER_OBJECT driverObject, driverObject->DriverUnload = OvsExtUnload; status = NdisFRegisterFilterDriver(driverObject, - (NDIS_HANDLE) gOvsExtDriverObject, - &driverChars, &gOvsExtDriverHandle); + (NDIS_HANDLE)gOvsExtDriverObject, + &driverChars, + &gOvsExtDriverHandle); if (status != NDIS_STATUS_SUCCESS) { - return status; + goto cleanup; } - /* Create the communication channel for usersapce. */ + /* Create the communication channel for userspace. */ status = OvsCreateDeviceObject(gOvsExtDriverHandle); if (status != NDIS_STATUS_SUCCESS) { + goto cleanup; + } + +cleanup: + if (status != NDIS_STATUS_SUCCESS){ OvsCleanup(); - NdisFDeregisterFilterDriver(gOvsExtDriverHandle); - gOvsExtDriverHandle = NULL; + if (gOvsExtDriverHandle) { + NdisFDeregisterFilterDriver(gOvsExtDriverHandle); + gOvsExtDriverHandle = NULL; + } } return status;