Message ID | 20210812155735.3113912-2-harry.van.haaren@intel.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,v2,1/2] dpif-netdev: fix memory leak in dpcls subtable set command | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
On 12/08/2021 16:57, Harry van Haaren wrote: > 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 <harry.van.haaren@intel.com> > LGTM, Acked-by: Kevin Traynor <ktraynor@redhat.com> > --- > > 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); >
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);
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 <harry.van.haaren@intel.com> --- 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(+)