diff mbox series

[ovs-dev,2/2] dpif-netdev: Return error code when no mark available.

Message ID 20200523122828.54627-2-xiangxia.m.yue@gmail.com
State New
Headers show
Series [ovs-dev,1/2] dpif-netdev: Add check mark to avoid ovs-vswitchd crash. | expand

Commit Message

Tonghao Zhang May 23, 2020, 12:28 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

The max number of mark is (UINT32_MAX - 1), that is
enough to be used. But theoretically, if there are no
mark available, the later different flows will shared
the mark INVALID_FLOW_MARK, that may break the function.
If there are no available mark to be used, return error
code.

Cc: Yuanhan Liu <yliu@fridaylinux.org>
Cc: Ian Stokes <i.maximets@ovn.org>
Cc: Ben Pfaff <blp@ovn.org>
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 lib/dpif-netdev.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 25c4b960857a..a001e5b4ea4a 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2426,6 +2426,7 @@  dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
         mark = flow_mark_alloc();
         if (mark == INVALID_FLOW_MARK) {
             VLOG_ERR("Failed to allocate flow mark!\n");
+            return -1;
         }
     }
     info.flow_mark = mark;