Skip to content

Commit 38e8a5c

Browse files
roidayanSaeed Mahameed
authored andcommitted
net/mlx5e: IPoIB, Fix access to invalid memory address
When cleaning rdma netdevice we need to save the mdev pointer because priv is released when we release netdev. This bug was found using the kernel address sanitizer (KASAN). use-after-free in mlx5_rdma_netdev_free+0xe3/0x100 [mlx5_core] Fixes: 48935bb ("net/mlx5e: IPoIB, Add netdevice profile skeleton") Signed-off-by: Roi Dayan <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent c2cc187 commit 38e8a5c

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/ipoib

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,13 @@ void mlx5_rdma_netdev_free(struct net_device *netdev)
572572
{
573573
struct mlx5e_priv *priv = mlx5i_epriv(netdev);
574574
const struct mlx5e_profile *profile = priv->profile;
575+
struct mlx5_core_dev *mdev = priv->mdev;
575576

576577
mlx5e_detach_netdev(priv);
577578
profile->cleanup(priv);
578579
destroy_workqueue(priv->wq);
579580
free_netdev(netdev);
580581

581-
mlx5e_destroy_mdev_resources(priv->mdev);
582+
mlx5e_destroy_mdev_resources(mdev);
582583
}
583584
EXPORT_SYMBOL(mlx5_rdma_netdev_free);

0 commit comments

Comments
 (0)