Patch "net/mlx5e: Fix crash moving to switchdev mode when ntuple offload is set" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/mlx5e: Fix crash moving to switchdev mode when ntuple offload is set

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-mlx5e-fix-crash-moving-to-switchdev-mode-when-nt.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3e4bc90736aae3afb4f8bcb372ed915c36327df2
Author: Amir Tzin <amirtz@xxxxxxxxxx>
Date:   Tue May 30 20:11:14 2023 +0300

    net/mlx5e: Fix crash moving to switchdev mode when ntuple offload is set
    
    [ Upstream commit 3ec43c1b082a8804472430e1253544d75f4b540e ]
    
    Moving to switchdev mode with ntuple offload on causes the kernel to
    crash since fs->arfs is freed during nic profile cleanup flow.
    
    Ntuple offload is not supported in switchdev mode and it is already
    unset by mlx5 fix feature ndo in switchdev mode. Verify fs->arfs is
    valid before disabling it.
    
    trace:
    [] RIP: 0010:_raw_spin_lock_bh+0x17/0x30
    [] arfs_del_rules+0x44/0x1a0 [mlx5_core]
    [] mlx5e_arfs_disable+0xe/0x20 [mlx5_core]
    [] mlx5e_handle_feature+0x3d/0xb0 [mlx5_core]
    [] ? __rtnl_unlock+0x25/0x50
    [] mlx5e_set_features+0xfe/0x160 [mlx5_core]
    [] __netdev_update_features+0x278/0xa50
    [] ? netdev_run_todo+0x5e/0x2a0
    [] netdev_update_features+0x22/0x70
    [] ? _cond_resched+0x15/0x30
    [] mlx5e_attach_netdev+0x12a/0x1e0 [mlx5_core]
    [] mlx5e_netdev_attach_profile+0xa1/0xc0 [mlx5_core]
    [] mlx5e_netdev_change_profile+0x77/0xe0 [mlx5_core]
    [] mlx5e_vport_rep_load+0x1ed/0x290 [mlx5_core]
    [] mlx5_esw_offloads_rep_load+0x88/0xd0 [mlx5_core]
    [] esw_offloads_load_rep.part.38+0x31/0x50 [mlx5_core]
    [] esw_offloads_enable+0x6c5/0x710 [mlx5_core]
    [] mlx5_eswitch_enable_locked+0x1bb/0x290 [mlx5_core]
    [] mlx5_devlink_eswitch_mode_set+0x14f/0x320 [mlx5_core]
    [] devlink_nl_cmd_eswitch_set_doit+0x94/0x120
    [] genl_family_rcv_msg_doit.isra.17+0x113/0x150
    [] genl_family_rcv_msg+0xb7/0x170
    [] ? devlink_nl_cmd_port_split_doit+0x100/0x100
    [] genl_rcv_msg+0x47/0xa0
    [] ? genl_family_rcv_msg+0x170/0x170
    [] netlink_rcv_skb+0x4c/0x130
    [] genl_rcv+0x24/0x40
    [] netlink_unicast+0x19a/0x230
    [] netlink_sendmsg+0x204/0x3d0
    [] sock_sendmsg+0x50/0x60
    
    Fixes: 90b22b9bcd24 ("net/mlx5e: Disable Rx ntuple offload for uplink representor")
    Signed-off-by: Amir Tzin <amirtz@xxxxxxxxxx>
    Reviewed-by: Aya Levin <ayal@xxxxxxxxxx>
    Signed-off-by: Saeed Mahameed <saeedm@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
index bed0c2d043e70..329d8c90facdd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
@@ -135,6 +135,16 @@ static void arfs_del_rules(struct mlx5e_flow_steering *fs);
 
 int mlx5e_arfs_disable(struct mlx5e_flow_steering *fs)
 {
+	/* Moving to switchdev mode, fs->arfs is freed by mlx5e_nic_profile
+	 * cleanup_rx callback and it is not recreated when
+	 * mlx5e_uplink_rep_profile is loaded as mlx5e_create_flow_steering()
+	 * is not called by the uplink_rep profile init_rx callback. Thus, if
+	 * ntuple is set, moving to switchdev flow will enter this function
+	 * with fs->arfs nullified.
+	 */
+	if (!mlx5e_fs_get_arfs(fs))
+		return 0;
+
 	arfs_del_rules(fs);
 
 	return arfs_disable(fs);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux