mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +00:00
dpif-netdev: fix memory leak in dpif and mfex commands
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> Acked-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
committed by
Ian Stokes
parent
01cbe1ed41
commit
0b3a5d7add
@@ -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));
|
||||
@@ -1266,6 +1270,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);
|
||||
|
Reference in New Issue
Block a user