The TAP driver does not initialize all the elements of the rte_flow
structure. This can lead to crash in rte_flow_destroy.
(gdb) where
flow=0x100e99280, error=0x0)
at drivers/net/tap/tap_flow.c:1514
(gdb) p remote_flow
$1 = (struct rte_flow *) 0x6b6b6b6b6b6b6b6b
Which is here:
static int
tap_flow_destroy_pmd(struct pmd_internals *pmd,
struct rte_flow *flow,
struct rte_flow_error *error)
{
struct rte_flow *remote_flow = flow->remote_flow;
...
if (remote_flow) {
remote_flow->msg.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
Simplest fix is to use rte_zmalloc() so remote_flow and other fields
are always set at zero.
Fixes:
2bc06869cd94 ("net/tap: add remote netdevice traffic capture")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
NULL, "priority value too big");
goto fail;
}
NULL, "priority value too big");
goto fail;
}
- flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
+ flow = rte_zmalloc(__func__, sizeof(struct rte_flow), 0);
if (!flow) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "cannot allocate memory for rte_flow");
if (!flow) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "cannot allocate memory for rte_flow");
* to the local pmd->if_index.
*/
if (pmd->remote_if_index) {
* to the local pmd->if_index.
*/
if (pmd->remote_if_index) {
- remote_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
+ remote_flow = rte_zmalloc(__func__, sizeof(struct rte_flow), 0);
if (!remote_flow) {
rte_flow_error_set(
error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
if (!remote_flow) {
rte_flow_error_set(
error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
- remote_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
+ remote_flow = rte_zmalloc(__func__, sizeof(struct rte_flow), 0);
if (!remote_flow) {
TAP_LOG(ERR, "Cannot allocate memory for rte_flow");
goto fail;
if (!remote_flow) {
TAP_LOG(ERR, "Cannot allocate memory for rte_flow");
goto fail;
- rss_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
+ rss_flow = rte_zmalloc(__func__, sizeof(struct rte_flow), 0);
if (!rss_flow) {
TAP_LOG(ERR,
"Cannot allocate memory for rte_flow");
if (!rss_flow) {
TAP_LOG(ERR,
"Cannot allocate memory for rte_flow");