diff options
author | Ilya Maximets <i.maximets@samsung.com> | 2019-05-13 14:37:26 +0300 |
---|---|---|
committer | Ilya Maximets <i.maximets@samsung.com> | 2019-06-06 17:24:59 +0300 |
commit | 2611ef23691f8ad346f69e671b7cfe7d72d13ce3 (patch) | |
tree | f33c8a2e7ae46497c1a87cfa100317c71bfb61fc | |
parent | d18235e144485b8495c7f98bbbff4140250d4e01 (diff) | |
download | openvswitch-2611ef23691f8ad346f69e671b7cfe7d72d13ce3.tar.gz |
dpif-netdev: Fix flow mark leak on port lookup failure.
Flow mark should be properly freed in all error cases.
Fixes: 241bad15d99a ("dpif-netdev: associate flow with a mark id")
Acked-By: Roni Bar Yanai <roniba@mellanox.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
-rw-r--r-- | lib/dpif-netdev.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index b605f1b85..14a812667 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2382,7 +2382,7 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload) port = dp_netdev_lookup_port(pmd->dp, in_port); if (!port) { ovs_mutex_unlock(&pmd->dp->port_mutex); - return -1; + goto err_free; } ret = netdev_flow_put(port->netdev, &offload->match, CONST_CAST(struct nlattr *, offload->actions), @@ -2391,20 +2391,22 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload) ovs_mutex_unlock(&pmd->dp->port_mutex); if (ret) { - if (!modification) { - flow_mark_free(mark); - } else { - mark_to_flow_disassociate(pmd, flow); - } - return -1; + goto err_free; } if (!modification) { megaflow_to_mark_associate(&flow->mega_ufid, mark); mark_to_flow_associate(mark, flow); } - return 0; + +err_free: + if (!modification) { + flow_mark_free(mark); + } else { + mark_to_flow_disassociate(pmd, flow); + } + return -1; } static void * |