From: Daniel Borkmann Date: Sat, 19 Nov 2016 00:45:02 +0000 (+0100) Subject: bpf, mlx5: drop priv->xdp_prog reference on netdev cleanup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a055c19be98bc065a4478663ba7f6833693b8958;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git bpf, mlx5: drop priv->xdp_prog reference on netdev cleanup mlx5e_xdp_set() is currently the only place where we drop reference on the prog sitting in priv->xdp_prog when it's exchanged by a new one. We also need to make sure that we eventually release that reference, for example, in case the netdev is dismantled, otherwise we leak the program. Fixes: 86994156c736 ("net/mlx5e: XDP fast RX drop bpf programs support") Signed-off-by: Daniel Borkmann Acked-by: Saeed Mahameed Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 491cff9cf368..695760878898 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3705,6 +3705,9 @@ static void mlx5e_nic_cleanup(struct mlx5e_priv *priv) if (MLX5_CAP_GEN(mdev, vport_group_manager)) mlx5_eswitch_unregister_vport_rep(esw, 0); + + if (priv->xdp_prog) + bpf_prog_put(priv->xdp_prog); } static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)