]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath-windows: fix excessive stack usage in iphelper
authorAlin Serdean <aserdean@cloudbasesolutions.com>
Fri, 14 Jul 2017 04:40:57 +0000 (04:40 +0000)
committerBen Pfaff <blp@ovn.org>
Wed, 2 Aug 2017 18:32:07 +0000 (11:32 -0700)
`OvsGetOrResolveIPNeigh` uses a stack over 1024 bytes.

Switch one parameter to be a pointer.

Found using WDK 8.1 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
datapath-windows/ovsext/IpHelper.c

index 555351a5c527f4bd30ded41d4ba8df904a59501f..3021c3c6a1da7be3699d09f25ff76504aff59d31 100644 (file)
@@ -485,7 +485,7 @@ OvsResolveIPNeighEntry(PMIB_IPNET_ROW2 ipNeigh)
 
 
 NTSTATUS
-OvsGetOrResolveIPNeigh(MIB_IF_ROW2 ipRow,
+OvsGetOrResolveIPNeigh(PMIB_IF_ROW2 ipRow,
                        UINT32 ipAddr,
                        PMIB_IPNET_ROW2 ipNeigh)
 {
@@ -494,8 +494,8 @@ OvsGetOrResolveIPNeigh(MIB_IF_ROW2 ipRow,
     ASSERT(ipNeigh);
 
     RtlZeroMemory(ipNeigh, sizeof (*ipNeigh));
-    ipNeigh->InterfaceLuid.Value = ipRow.InterfaceLuid.Value;
-    ipNeigh->InterfaceIndex = ipRow.InterfaceIndex;
+    ipNeigh->InterfaceLuid.Value = ipRow->InterfaceLuid.Value;
+    ipNeigh->InterfaceIndex = ipRow->InterfaceIndex;
     ipNeigh->Address.si_family = AF_INET;
     ipNeigh->Address.Ipv4.sin_addr.s_addr = ipAddr;
 
@@ -503,8 +503,8 @@ OvsGetOrResolveIPNeigh(MIB_IF_ROW2 ipRow,
 
     if (status != STATUS_SUCCESS) {
         RtlZeroMemory(ipNeigh, sizeof (*ipNeigh));
-        ipNeigh->InterfaceLuid.Value = ipRow.InterfaceLuid.Value;
-        ipNeigh->InterfaceIndex = ipRow.InterfaceIndex;
+        ipNeigh->InterfaceLuid.Value = ipRow->InterfaceLuid.Value;
+        ipNeigh->InterfaceIndex = ipRow->InterfaceIndex;
         ipNeigh->Address.si_family = AF_INET;
         ipNeigh->Address.Ipv4.sin_addr.s_addr = ipAddr;
         status = OvsResolveIPNeighEntry(ipNeigh);
@@ -1643,7 +1643,7 @@ OvsHandleFwdRequest(POVS_IP_HELPER_REQUEST request)
     if (ipAddr == 0) {
         ipAddr = request->fwdReq.tunnelKey.dst;
     }
-    status = OvsGetOrResolveIPNeigh(instance->internalRow,
+    status = OvsGetOrResolveIPNeigh(&instance->internalRow,
                                     ipAddr, &ipNeigh);
     if (status != STATUS_SUCCESS) {
         ExReleaseResourceLite(&instance->lock);
@@ -1935,11 +1935,10 @@ OvsStartIpHelper(PVOID data)
             MIB_IPNET_ROW2 ipNeigh;
             NTSTATUS status;
             POVS_IPHELPER_INSTANCE instance = (POVS_IPHELPER_INSTANCE)ipn->context;
-            MIB_IF_ROW2 internalRow = instance->internalRow;
             NdisReleaseSpinLock(&ovsIpHelperLock);
             ExAcquireResourceExclusiveLite(&ovsInstanceListLock, TRUE);
 
-            status = OvsGetOrResolveIPNeigh(internalRow,
+            status = OvsGetOrResolveIPNeigh(&instance->internalRow,
                                             ipAddr, &ipNeigh);
             OvsUpdateIPNeighEntry(ipAddr, &ipNeigh, status);