[ovs-dev] [PATCH 28/40] datapath-windows: Fix possible NULL deference in OvsFullCopyNBL

Alin Serdean aserdean at cloudbasesolutions.com
Fri Jul 14 04:40:56 UTC 2017


Check if the first net buffer exists before trying to copy it.

Found using WDK 10 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
 datapath-windows/ovsext/BufferMgmt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/datapath-windows/ovsext/BufferMgmt.c b/datapath-windows/ovsext/BufferMgmt.c
index c81ca2a..d913380 100644
--- a/datapath-windows/ovsext/BufferMgmt.c
+++ b/datapath-windows/ovsext/BufferMgmt.c
@@ -985,6 +985,9 @@ OvsFullCopyNBL(PVOID ovsContext,
     }
 
     nb = NET_BUFFER_LIST_FIRST_NB(nbl);
+    if (nb == NULL) {
+        return NULL;
+    }
 
     if (NET_BUFFER_NEXT_NB(nb) == NULL) {
         return OvsCopySinglePacketNBL(context, nbl, nb, headRoom, copyNblInfo);
-- 
2.10.2.windows.1


More information about the dev mailing list