diff mbox series

[ovs-dev] odp-execute: Fix null pointer dereference on empty nlattr.

Message ID 416509e9b0c733a07b2fe3959a8e616998e7a91c.1760112679.git.echaudro@redhat.com
State Rejected
Headers show
Series [ovs-dev] odp-execute: Fix null pointer dereference on empty nlattr. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/cirrus-robot success cirrus build: passed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Eelco Chaudron Oct. 10, 2025, 4:11 p.m. UTC
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 <echaudro@redhat.com>
---
 lib/odp-execute.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

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);