DPDK patches and discussions
 help / color / mirror / Atom feed
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>,
	<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix wrong exception handling
Date: Mon, 29 May 2017 18:02:59 -0700	[thread overview]
Message-ID: <20170530010259.48823-1-yskoh@mellanox.com> (raw)

A sanity check is required in priv_fdir_disable(). If resizing Rx queue
fails, this can cause a crash by referencing a NULL pointer.

Cc: stable@dpdk.org
Fixes: 76f5c99e6840 ("mlx5: support flow director")
Fixes: 0cdddf4d0626 ("net/mlx5: split Rx queue structure")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_fdir.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_fdir.c b/drivers/net/mlx5/mlx5_fdir.c
index f80c58b4d..1cff41bab 100644
--- a/drivers/net/mlx5/mlx5_fdir.c
+++ b/drivers/net/mlx5/mlx5_fdir.c
@@ -733,9 +733,11 @@ priv_fdir_disable(struct priv *priv)
 
 	/* Destroy flow director context in each RX queue. */
 	for (i = 0; (i != priv->rxqs_n); i++) {
-		struct rxq_ctrl *rxq_ctrl =
-			container_of((*priv->rxqs)[i], struct rxq_ctrl, rxq);
+		struct rxq_ctrl *rxq_ctrl;
 
+		if (!(*priv->rxqs)[i])
+			continue;
+		rxq_ctrl = container_of((*priv->rxqs)[i], struct rxq_ctrl, rxq);
 		if (!rxq_ctrl->fdir_queue)
 			continue;
 		priv_fdir_queue_destroy(priv, rxq_ctrl->fdir_queue);
-- 
2.11.0

             reply	other threads:[~2017-05-30  1:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  1:02 Yongseok Koh [this message]
2017-05-30  7:48 ` Adrien Mazarguil
2017-06-01 10:24   ` 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=20170530010259.48823-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 \
    --cc=stable@dpdk.org \
    /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).