lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR05MB4786D1F16A12978B06DE7959C5FC0@AM0PR05MB4786.eurprd05.prod.outlook.com>
Date:   Wed, 11 Mar 2020 10:10:38 +0000
From:   Eli Cohen <eli@...lanox.com>
To:     Parav Pandit <parav@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        "David S. Miller" <davem@...emloft.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Vlad Buslov <vladbu@...lanox.com>,
        Raed Salem <raeds@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>
Subject: RE: [net 5/5] net/mlx5: Clear LAG notifier pointer after unregister

Hi Parav,

My patch did not fix the issue you are quoting below with call trace. It  has been fixed by this patch:
commit e387f7d5fccf95299135c88b799184c3bef6a705
Author: Jiri Pirko <jiri@...lanox.com>
Date:   Thu Feb 27 08:22:10 2020 +0100

    mlx5: register lag notifier for init network namespace only

My fix is straightforward. Look at the patch.


-----Original Message-----
From: Parav Pandit <parav@...lanox.com> 
Sent: Monday, March 9, 2020 9:09 PM
To: Saeed Mahameed <saeedm@...lanox.com>; David S. Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org; Eli Cohen <eli@...lanox.com>; Vlad Buslov <vladbu@...lanox.com>; Raed Salem <raeds@...lanox.com>; Saeed Mahameed <saeedm@...lanox.com>
Subject: RE: [net 5/5] net/mlx5: Clear LAG notifier pointer after unregister

Hi Eli,

> Sent: Thursday, March 5, 2020 5:18 PM
> To: David S. Miller <davem@...emloft.net>
> 
> From: Eli Cohen <eli@...lanox.com>
> 
> After returning from unregister_netdevice_notifier_dev_net(), set the 
> notifier_call field to NULL so successive call to mlx5_lag_add() will 
> function as expected.
> 
> Fixes: 7907f23adc18 ("net/mlx5: Implement RoCE LAG feature")
> Signed-off-by: Eli Cohen <eli@...lanox.com>
> Reviewed-by: Vlad Buslov <vladbu@...lanox.com>
> Reviewed-by: Raed Salem <raeds@...lanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@...lanox.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/lag.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
> b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
> index 8e19f6ab8393..93052b07c76c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
> @@ -615,8 +615,10 @@ void mlx5_lag_remove(struct mlx5_core_dev *dev)
>  			break;
> 
>  	if (i == MLX5_MAX_PORTS) {
> -		if (ldev->nb.notifier_call)
> +		if (ldev->nb.notifier_call) {
>  			unregister_netdevice_notifier_net(&init_net, &ldev-
> >nb);
> +			ldev->nb.notifier_call = NULL;
> +		}
>  		mlx5_lag_mp_cleanup(ldev);
>  		cancel_delayed_work_sync(&ldev->bond_work);
>  		mlx5_lag_dev_free(ldev);
> --
> 2.24.1

I have noticed this and applied this local change to avoid below call trace and reported it to Leon few days back in different discussion.

But I fail to justify that this was/is the right fix. To me it seems to hide another bug.
Can you please explain the flow why mlx5_lag_remove() will be called twice with i = 2 because of which null check is needed to avoid unregister_notifier second time?

RIP: 0010:__list_del_entry_valid+0x7c/0xa0
unregister_netdevice_notifier_dev_net+0x1f/0x70
mlx5_lag_remove+0x61/0xf0 [mlx5_core]
mlx5e_detach_netdev+0x24/0x50 [mlx5_core]
mlx5e_detach+0x36/0x40 [mlx5_core]
mlx5e_remove+0x48/0x60 [mlx5_core]
mlx5_remove_device+0xb0/0xc0 [mlx5_core]
mlx5_unregister_interface+0x39/0x90 [mlx5_core]
cleanup+0x5/0xdd1 [mlx5_core]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ