From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DD343432B0; Mon, 6 Nov 2023 15:18:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A22040A67; Mon, 6 Nov 2023 15:18:17 +0100 (CET) Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by mails.dpdk.org (Postfix) with ESMTP id 605D94028B; Sat, 4 Nov 2023 11:28:54 +0100 (CET) X-QQ-mid: bizesmtp67t1699093728twc2r3w6 Received: from liwg-V5320.. ( [36.112.73.58]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 04 Nov 2023 18:28:37 +0800 (CST) X-QQ-SSF: 01100000000000108000000A0000000 X-QQ-FEAT: D6RqbDSxuq6hqTMI5EYBTu9k5YPUVCbuepwFSj3PKPQ1p9vewvOrT+B7kbjxW A5Q1rfyBJm782S7s4+Yev4XfAeLo8hKmuv8lYn+izRF69/ZgyqfwbqSF2pgH1Xy3vHzyi3S JgHfkLfeTAy0q++rHqZUm7b0a37QzImVR7ieNpKin906P7+8YQ447HyD31XIMYWpmKZQ4e1 wqi6mmHOhmVSqu8q4t9p4h9gj6SzRRvo2ol89w4iIJ1tLz6SuVgOJAi6343IzI4hjigdhhf hoE+qyA+XNYS19x79tj4KZS0kHU62EKSZqhiodZ5gAeaD7aisZ0Y5QxDLsUluf96x484N/u iLX5rCMj38HgvGmFNuLYSzNgdRf+0t3IIcx9bG7pb2c2bI63w0L5DMcX1RWnA== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7644962349576096817 From: Weiguo Li 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 Message-Id: <20231104102836.2134140-1-liweiguo@xencore.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:xencore.cn:qybglogicsvrgz:qybglogicsvrgz5a-0 X-Mailman-Approved-At: Mon, 06 Nov 2023 15:18:13 +0100 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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