DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: nelio.laranjeiro@6wind.com, adrien.mazarguil@6wind.com,
	yskoh@mellanox.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] net/mlx5: fix segfault on interrupt disable
Date: Tue, 17 Oct 2017 15:04:56 +0300	[thread overview]
Message-ID: <20171017120457.122693-1-shahafs@mellanox.com> (raw)

Interrupt disable can be called when the interrupt vector is not yet
allocated. Such case ends up with segmentation fault.

Fixing it by adding verification for interrupt vector validity.

Fixes: 09cb5b581762 ("net/mlx5: separate DPDK from verbs Rx queue objects")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index ad741ef44..2beebfdf2 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -396,6 +396,8 @@ priv_rx_intr_vec_disable(struct priv *priv)
 
 	if (!priv->dev->data->dev_conf.intr_conf.rxq)
 		return;
+	if (!intr_handle->intr_vec)
+		goto free;
 	for (i = 0; i != n; ++i) {
 		struct mlx5_rxq_ctrl *rxq_ctrl;
 		struct mlx5_rxq_data *rxq_data;
@@ -411,8 +413,10 @@ priv_rx_intr_vec_disable(struct priv *priv)
 		rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
 		mlx5_priv_rxq_ibv_release(priv, rxq_ctrl->ibv);
 	}
+free:
 	rte_intr_free_epoll_fd(intr_handle);
-	free(intr_handle->intr_vec);
+	if (intr_handle->intr_vec)
+		free(intr_handle->intr_vec);
 	intr_handle->nb_efd = 0;
 	intr_handle->intr_vec = NULL;
 }
-- 
2.12.0

             reply	other threads:[~2017-10-17 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 12:04 Shahaf Shuler [this message]
2017-10-17 12:04 ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix interrupt management fields assignment Shahaf Shuler
2017-10-23 17:49 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix segfault on interrupt disable Ferruh Yigit

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=20171017120457.122693-1-shahafs@mellanox.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=yskoh@mellanox.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).