diff mbox series

[ovs-dev,04/10] netdev-offload-tc: Check for valid netdev ifindex in flow_put

Message ID 164329041937.2583748.7077299796459569172.stgit@ebuild
State Superseded
Headers show
Series netdev-offload-tc: Fix various tc-offload related problems | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Eelco Chaudron Jan. 27, 2022, 1:33 p.m. UTC
Verify that the returned ifindex by netdev_get_ifindex() is valid.
This might not be the case in the ERSPAN port scenario, which can
not be offloaded.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/netdev-offload-tc.c |    9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index 9845e8d3f..8135441c6 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -1842,6 +1842,15 @@  netdev_tc_flow_put(struct netdev *netdev, struct match *match,
                 return ENODEV;
             }
             action->out.ifindex_out = netdev_get_ifindex(outdev);
+
+            if (action->out.ifindex_out < 0) {
+                VLOG_DBG_RL(&rl,
+                            "Can't find ifindex for output port %s, error %d",
+                            netdev_get_name(outdev), action->out.ifindex_out);
+
+                return -action->out.ifindex_out;
+            }
+
             action->out.ingress = is_internal_port(netdev_get_type(outdev));
             action->type = TC_ACT_OUTPUT;
             flower.action_count++;