This patch fixes a potential null pointer dereference reported
by Coverity if an empty action list is passed to
odp_execute_sample().

Fixes: 26c6b6cd2b2e ("dpif-netdev: Implement OVS_ACTION_ATTR_SAMPLE action.")
Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/odp-execute.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 7f4e337f8..4e2edb70d 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -714,6 +714,10 @@ odp_execute_sample(void *dp, struct dp_packet *packet, 
bool steal,
     struct dp_packet_batch pb;
     size_t left;
 
+    if (!action || nl_attr_get_size(action) == 0) {
+        return;
+    }
+
     NL_NESTED_FOR_EACH_UNSAFE (a, left, action) {
         int type = nl_attr_type(a);
 
-- 
2.50.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to