This patch fixes a memory leak in the commands for DPIF and MFEX
get and set. In order to operate the commands require a pmd_list,
which is currently not freed after it has been used. This issue
was identified by a static analysis tool.
Fixes: 3d8f47bc ("dpif-netdev: Add command line and function pointer for
miniflow extract")
Fixes: abb807e2 ("dpif-netdev: Add command to switch dpif implementation.")
Signed-off-by: Harry van Haaren <[email protected]>
---
Maintainers; these mem leaks were introduced in this release,
so are not candidates for backporting.
---
lib/dpif-netdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 9e0d5c3103..37a5839684 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1025,6 +1025,7 @@ dpif_netdev_impl_get(struct unixctl_conn *conn, int argc
OVS_UNUSED,
* thread. */
sorted_poll_thread_list(dp, &pmd_list, &n);
dp_netdev_impl_get(&reply, pmd_list, n);
+ free(pmd_list);
}
ovs_mutex_unlock(&dp_netdev_mutex);
unixctl_command_reply(conn, ds_cstr(&reply));
@@ -1079,6 +1080,8 @@ dpif_netdev_impl_set(struct unixctl_conn *conn, int argc
OVS_UNUSED,
atomic_uintptr_t *pmd_func = (void *) &pmd->netdev_input_func;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
};
+
+ free(pmd_list);
}
ovs_mutex_unlock(&dp_netdev_mutex);
@@ -1109,6 +1112,7 @@ dpif_miniflow_extract_impl_get(struct unixctl_conn *conn,
int argc OVS_UNUSED,
* thread. */
sorted_poll_thread_list(dp, &pmd_list, &n);
dp_mfex_impl_get(&reply, pmd_list, n);
+ free(pmd_list);
}
ovs_mutex_unlock(&dp_netdev_mutex);
unixctl_command_reply(conn, ds_cstr(&reply));
@@ -1267,6 +1271,8 @@ dpif_miniflow_extract_impl_set(struct unixctl_conn *conn,
int argc,
atomic_uintptr_t *pmd_func = (void *) &pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) mfex_func);
};
+
+ free(pmd_list);
}
ovs_mutex_unlock(&dp_netdev_mutex);
--
2.30.2
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev