From patchwork Thu Sep 3 14:01:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Raju X-Patchwork-Id: 514069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 86EE51402A3 for ; Fri, 4 Sep 2015 00:02:00 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 60B4310B32; Thu, 3 Sep 2015 07:01:59 -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 AEE5610B30 for ; Thu, 3 Sep 2015 07:01:57 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 0DB1A1E01ED for ; Thu, 3 Sep 2015 08:01:57 -0600 (MDT) X-ASG-Debug-ID: 1441288913-09eadd603143de0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id Dya69kKoiYKaBmwK (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 03 Sep 2015 08:01:53 -0600 (MDT) X-Barracuda-Envelope-From: nithin@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO smtp-outbound-2.vmware.com) (208.91.2.13) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 3 Sep 2015 14:01:52 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _spf.vmware.com designates 208.91.2.13 as permitted sender) X-Barracuda-Apparent-Source-IP: 208.91.2.13 X-Barracuda-RBL-IP: 208.91.2.13 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 6518A281B9 for ; Thu, 3 Sep 2015 07:02:01 -0700 (PDT) Received: from pa-dbc1122.eng.vmware.com (unknown [10.162.210.22]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 9057440487; Thu, 3 Sep 2015 07:01:50 -0700 (PDT) X-CudaMail-Envelope-Sender: nithin@vmware.com From: Nithin Raju To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-902021233 X-CudaMail-DTE: 090315 X-CudaMail-Originating-IP: 208.91.2.13 Date: Thu, 3 Sep 2015 07:01:49 -0700 X-ASG-Orig-Subj: [##CM-E1-902021233##][PATCH] datapath-windows: check vport attribute before access Message-Id: <1441288909-7326-1-git-send-email-nithin@vmware.com> X-Mailer: git-send-email 1.8.5.6 X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1441288913 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 X-ASG-Whitelist: EmailCat (corporate) Subject: [ovs-dev] [PATCH] datapath-windows: check vport attribute before access 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" OVS_VPORT_ATTR_OPTIONS being an optional attribute should be preceded by a check for valid value before access. Signed-off-by: Nithin Raju Acked-by: Sairam Venugopal --- datapath-windows/ovsext/Vport.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c index 6b74ec2..dd615e4 100644 --- a/datapath-windows/ovsext/Vport.c +++ b/datapath-windows/ovsext/Vport.c @@ -2177,10 +2177,12 @@ OvsNewVportCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx, break; } - PNL_ATTR attr = NlAttrFindNested(vportAttrs[OVS_VPORT_ATTR_OPTIONS], - OVS_TUNNEL_ATTR_DST_PORT); - if (attr) { - transportPortDest = NlAttrGetU16(attr); + if (vportAttrs[OVS_VPORT_ATTR_OPTIONS]) { + PNL_ATTR attr = NlAttrFindNested(vportAttrs[OVS_VPORT_ATTR_OPTIONS], + OVS_TUNNEL_ATTR_DST_PORT); + if (attr) { + transportPortDest = NlAttrGetU16(attr); + } } status = OvsInitTunnelVport(usrParamsCtx,