]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/mlx5e: Fix crash unsetting rx-vlan-filter in switchdev mode
authorAmir Tzin <amirtz@nvidia.com>
Sun, 8 Jan 2023 13:54:46 +0000 (15:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Feb 2023 18:11:46 +0000 (19:11 +0100)
[ Upstream commit 8974aa9638df557f4642acef707af15648a03555 ]

Moving to switchdev mode with rx-vlan-filter on and then setting it off
causes the kernel to crash since fs->vlan is freed during nic profile
cleanup flow.

RX VLAN filtering is not supported in switchdev mode so unset it when
changing to switchdev and restore its value when switching back to
legacy.

trace:
[] RIP: 0010:mlx5e_disable_cvlan_filter+0x43/0x70
[] set_feature_cvlan_filter+0x37/0x40 [mlx5_core]
[] mlx5e_handle_feature+0x3a/0x60 [mlx5_core]
[] mlx5e_set_features+0x6d/0x160 [mlx5_core]
[] __netdev_update_features+0x288/0xa70
[] ethnl_set_features+0x309/0x380
[] ? __nla_parse+0x21/0x30
[] genl_family_rcv_msg_doit.isra.17+0x110/0x150
[] genl_rcv_msg+0x112/0x260
[] ? features_reply_size+0xe0/0xe0
[] ? genl_family_rcv_msg_doit.isra.17+0x150/0x150
[] netlink_rcv_skb+0x4e/0x100
[] genl_rcv+0x24/0x40
[] netlink_unicast+0x1ab/0x290
[] netlink_sendmsg+0x257/0x4f0
[] sock_sendmsg+0x5c/0x70

Fixes: cb67b832921c ("net/mlx5e: Introduce SRIOV VF representors")
Signed-off-by: Amir Tzin <amirtz@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 1892ccb889b3fe87e6722619f7ddfe86a776ae90..7cd36f4ac3efc8685f35ca41279c9fe195bd8e2f 100644 (file)
@@ -443,7 +443,7 @@ void mlx5e_enable_cvlan_filter(struct mlx5e_flow_steering *fs, bool promisc)
 
 void mlx5e_disable_cvlan_filter(struct mlx5e_flow_steering *fs, bool promisc)
 {
-       if (fs->vlan->cvlan_filter_disabled)
+       if (!fs->vlan || fs->vlan->cvlan_filter_disabled)
                return;
 
        fs->vlan->cvlan_filter_disabled = true;
index 3e0d910b085d48706d67d0bdbd842cb125ec4973..142ed2d98cd5d77a89ef7f64e0a32b33e2d6a67b 100644 (file)
@@ -4005,6 +4005,10 @@ static netdev_features_t mlx5e_fix_uplink_rep_features(struct net_device *netdev
        if (netdev->features & NETIF_F_GRO_HW)
                netdev_warn(netdev, "Disabling HW_GRO, not supported in switchdev mode\n");
 
+       features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+       if (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
+               netdev_warn(netdev, "Disabling HW_VLAN CTAG FILTERING, not supported in switchdev mode\n");
+
        return features;
 }