net/mvpp2: fix null dereference in vmwa release
Checks
Commit Message
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(-)
Comments
Hi Weiguo,
> -----Original Message-----
> From: Weiguo Li <liweiguo@xencore.cn>
> Sent: Saturday, November 4, 2023 12:29 PM
> To: Ophir Munk <ophirmu@nvidia.com>
> Cc: lironh@marvell.com; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mvpp2: fix null dereference in vmwa release
>
> Pointer 'mrvl_cfg' is dereferenced and then compared to NULL.
> Move dereference after NULL test to fix this issue.
>
I think the commit log isn't relevant to the change really,
Can you kindly check that?
Kindest regards
Raslan Darawsheh
@@ -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);