Patch "net/mlx5e: Fix cleanup null-ptr deref on encap lock" has been added to the 6.1-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 cleanup null-ptr deref on encap lock

to the 6.1-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-cleanup-null-ptr-deref-on-encap-lock.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 8fb9aca65da8fa6eb8c56b92009ef79b9131b809
Author: Paul Blakey <paulb@xxxxxxxxxx>
Date:   Sun Feb 12 11:01:43 2023 +0200

    net/mlx5e: Fix cleanup null-ptr deref on encap lock
    
    [ Upstream commit c9668f0b1d28570327dbba189f2c61f6f9e43ae7 ]
    
    During module is unloaded while a peer tc flow is still offloaded,
    first the peer uplink rep profile is changed to a nic profile, and so
    neigh encap lock is destroyed. Next during unload, the VF reps netdevs
    are unregistered which causes the original non-peer tc flow to be deleted,
    which deletes the peer flow. The peer flow deletion detaches the encap
    entry and try to take the already destroyed encap lock, causing the
    below trace.
    
    Fix this by clearing peer flows during tc eswitch cleanup
    (mlx5e_tc_esw_cleanup()).
    
    Relevant trace:
    [ 4316.837128] BUG: kernel NULL pointer dereference, address: 00000000000001d8
    [ 4316.842239] RIP: 0010:__mutex_lock+0xb5/0xc40
    [ 4316.851897] Call Trace:
    [ 4316.852481]  <TASK>
    [ 4316.857214]  mlx5e_rep_neigh_entry_release+0x93/0x790 [mlx5_core]
    [ 4316.858258]  mlx5e_rep_encap_entry_detach+0xa7/0xf0 [mlx5_core]
    [ 4316.859134]  mlx5e_encap_dealloc+0xa3/0xf0 [mlx5_core]
    [ 4316.859867]  clean_encap_dests.part.0+0x5c/0xe0 [mlx5_core]
    [ 4316.860605]  mlx5e_tc_del_fdb_flow+0x32a/0x810 [mlx5_core]
    [ 4316.862609]  __mlx5e_tc_del_fdb_peer_flow+0x1a2/0x250 [mlx5_core]
    [ 4316.863394]  mlx5e_tc_del_flow+0x(/0x630 [mlx5_core]
    [ 4316.864090]  mlx5e_flow_put+0x5f/0x100 [mlx5_core]
    [ 4316.864771]  mlx5e_delete_flower+0x4de/0xa40 [mlx5_core]
    [ 4316.865486]  tc_setup_cb_reoffload+0x20/0x80
    [ 4316.865905]  fl_reoffload+0x47c/0x510 [cls_flower]
    [ 4316.869181]  tcf_block_playback_offloads+0x91/0x1d0
    [ 4316.869649]  tcf_block_unbind+0xe7/0x1b0
    [ 4316.870049]  tcf_block_offload_cmd.isra.0+0x1ee/0x270
    [ 4316.879266]  tcf_block_offload_unbind+0x61/0xa0
    [ 4316.879711]  __tcf_block_put+0xa4/0x310
    
    Fixes: 04de7dda7394 ("net/mlx5e: Infrastructure for duplicated offloading of TC flows")
    Fixes: 1418ddd96afd ("net/mlx5e: Duplicate offloaded TC eswitch rules under uplink LAG")
    Signed-off-by: Paul Blakey <paulb@xxxxxxxxxx>
    Reviewed-by: Chris Mi <cmi@xxxxxxxxxx>
    Reviewed-by: Roi Dayan <roid@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_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index a71eaa0601149..73af062a87830 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -5160,6 +5160,16 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)
 
 void mlx5e_tc_esw_cleanup(struct mlx5_rep_uplink_priv *uplink_priv)
 {
+	struct mlx5e_rep_priv *rpriv;
+	struct mlx5_eswitch *esw;
+	struct mlx5e_priv *priv;
+
+	rpriv = container_of(uplink_priv, struct mlx5e_rep_priv, uplink_priv);
+	priv = netdev_priv(rpriv->netdev);
+	esw = priv->mdev->priv.eswitch;
+
+	mlx5e_tc_clean_fdb_peer_flows(esw);
+
 	mlx5e_tc_tun_cleanup(uplink_priv->encap);
 
 	mapping_destroy(uplink_priv->tunnel_enc_opts_mapping);



[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