DPDK patches and discussions
 help / color / mirror / Atom feed
From: Weiguo Li <liweiguo@xencore.cn>
To: ophirmu@nvidia.com
Cc: lironh@marvell.com, dev@dpdk.org, stable@dpdk.org
Subject: [PATCH] net/mvpp2: fix null dereference in vmwa release
Date: Sat,  4 Nov 2023 18:28:36 +0800	[thread overview]
Message-ID: <20231104102836.2134140-1-liweiguo@xencore.cn> (raw)

Pointer 'mrvl_cfg' is dereferenced and then compared to NULL.
Move dereference after NULL test to fix this issue.

Fixes: 7af10d29a4a0 ("net/mlx5/linux: refactor VLAN")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 drivers/net/mlx5/linux/mlx5_vlan_os.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/linux/mlx5_vlan_os.c b/drivers/net/mlx5/linux/mlx5_vlan_os.c
index 81611a8d3f..391c9ce832 100644
--- a/drivers/net/mlx5/linux/mlx5_vlan_os.c
+++ b/drivers/net/mlx5/linux/mlx5_vlan_os.c
@@ -37,12 +37,13 @@ mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct mlx5_nl_vlan_vmwa_context *vmwa = priv->vmwa_context;
-	struct mlx5_nl_vlan_dev *vlan_dev = &vmwa->vlan_dev[0];
+	struct mlx5_nl_vlan_dev *vlan_dev;
 
 	MLX5_ASSERT(vlan->created);
 	MLX5_ASSERT(priv->vmwa_context);
 	if (!vlan->created || !vmwa)
 		return;
+	vlan_dev = &vmwa->vlan_dev[0];
 	vlan->created = 0;
 	rte_spinlock_lock(&vmwa->sl);
 	MLX5_ASSERT(vlan_dev[vlan->tag].refcnt);
-- 
2.34.1


             reply	other threads:[~2023-11-06 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04 10:28 Weiguo Li [this message]
2023-11-12 15:26 ` Raslan Darawsheh

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=20231104102836.2134140-1-liweiguo@xencore.cn \
    --to=liweiguo@xencore.cn \
    --cc=dev@dpdk.org \
    --cc=lironh@marvell.com \
    --cc=ophirmu@nvidia.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).