Skip to content

Commit

Permalink
netdev-offload-dpdk: Initialize s_tnl dynamic string.
Browse files Browse the repository at this point in the history
The 's_tnl' member in flow_patterns and flow_actions should be
to set to DS_EMPTY_INITIALIZER, to be consistent with dynamic string
initializations.

Also, there's a potential memory leak of flow_patterns->s_tnl.
Fix this by destroying s_tnl in free_flow_patterns().

Fixes: 507d20e ("netdev-offload-dpdk: Support vports flows offload.")
Fixes: be56e06 ("netdev-offload-dpdk: Support tunnel pop action.")
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Acked-by: Gaetan Rivet <grive@u256.net>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
sbasavapatna authored and igsilya committed Aug 16, 2021
1 parent 3e29c98 commit a7f5e85
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/netdev-offload-dpdk.c
Expand Up @@ -791,6 +791,7 @@ free_flow_patterns(struct flow_patterns *patterns)
free(patterns->items);
patterns->items = NULL;
patterns->cnt = 0;
ds_destroy(&patterns->s_tnl);
}

static void
Expand Down Expand Up @@ -1324,7 +1325,11 @@ netdev_offload_dpdk_mark_rss(struct flow_patterns *patterns,
struct netdev *netdev,
uint32_t flow_mark)
{
struct flow_actions actions = { .actions = NULL, .cnt = 0 };
struct flow_actions actions = {
.actions = NULL,
.cnt = 0,
.s_tnl = DS_EMPTY_INITIALIZER,
};
const struct rte_flow_attr flow_attr = {
.group = 0,
.priority = 0,
Expand Down Expand Up @@ -1809,7 +1814,11 @@ netdev_offload_dpdk_actions(struct netdev *netdev,
size_t actions_len)
{
const struct rte_flow_attr flow_attr = { .ingress = 1, .transfer = 1 };
struct flow_actions actions = { .actions = NULL, .cnt = 0 };
struct flow_actions actions = {
.actions = NULL,
.cnt = 0,
.s_tnl = DS_EMPTY_INITIALIZER,
};
struct rte_flow *flow = NULL;
struct rte_flow_error error;
int ret;
Expand All @@ -1833,7 +1842,11 @@ netdev_offload_dpdk_add_flow(struct netdev *netdev,
const ovs_u128 *ufid,
struct offload_info *info)
{
struct flow_patterns patterns = { .items = NULL, .cnt = 0 };
struct flow_patterns patterns = {
.items = NULL,
.cnt = 0,
.s_tnl = DS_EMPTY_INITIALIZER,
};
struct ufid_to_rte_flow_data *flows_data = NULL;
bool actions_offloaded = true;
struct rte_flow *flow;
Expand Down

0 comments on commit a7f5e85

Please sign in to comment.