From: Yongseok Koh <yskoh@mellanox.com>
To: <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, <adrien.mazarguil@6wind.com>,
<nelio.laranjeiro@6wind.com>, Yongseok Koh <yskoh@mellanox.com>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix crash on deleting flow drop queue
Date: Mon, 1 May 2017 14:05:42 -0700 [thread overview]
Message-ID: <20170501210542.5032-1-yskoh@mellanox.com> (raw)
If mlx5_dev_start() fails, it tries to rollback data structures related to
rte_flow including drop queue. The destruction code doesn't assume the
structures are created but priv_flow_delete_drop_queue() never does sanity
check. This can cause a crash.
Fixes: 028761059aeb ("net/mlx5: use an RSS drop queue")
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
drivers/net/mlx5/mlx5_flow.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index cd3e5daf3..adcbe3f52 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1465,13 +1465,18 @@ priv_flow_delete_drop_queue(struct priv *priv)
struct rte_flow_drop *fdq = priv->flow_drop_queue;
unsigned int i;
- claim_zero(ibv_destroy_qp(fdq->qp));
- claim_zero(ibv_exp_destroy_rwq_ind_table(fdq->ind_table));
+ if (!fdq)
+ return;
+ if (fdq->qp)
+ claim_zero(ibv_destroy_qp(fdq->qp));
+ if (fdq->ind_table)
+ claim_zero(ibv_exp_destroy_rwq_ind_table(fdq->ind_table));
for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
- assert(fdq->wqs[i]);
- claim_zero(ibv_exp_destroy_wq(fdq->wqs[i]));
+ if (fdq->wqs[i])
+ claim_zero(ibv_exp_destroy_wq(fdq->wqs[i]));
}
- claim_zero(ibv_destroy_cq(fdq->cq));
+ if (fdq->cq)
+ claim_zero(ibv_destroy_cq(fdq->cq));
rte_free(fdq);
priv->flow_drop_queue = NULL;
}
--
2.11.0
next reply other threads:[~2017-05-01 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-01 21:05 Yongseok Koh [this message]
2017-05-02 6:45 ` Nélio Laranjeiro
2017-05-05 15:48 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170501210542.5032-1-yskoh@mellanox.com \
--to=yskoh@mellanox.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=nelio.laranjeiro@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).