Patch "net/mlx5e: fix a potential double-free in fs_udp_create_groups" has been added to the 5.15-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 a potential double-free in fs_udp_create_groups

to the 5.15-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-a-potential-double-free-in-fs_udp_crea.patch
and it can be found in the queue-5.15 subdirectory.

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



commit d3ef61f0ecc8f2805a09e8ce0dd0a6e5c5281574
Author: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
Date:   Tue Nov 28 17:40:53 2023 +0800

    net/mlx5e: fix a potential double-free in fs_udp_create_groups
    
    [ Upstream commit e75efc6466ae289e599fb12a5a86545dff245c65 ]
    
    When kcalloc() for ft->g succeeds but kvzalloc() for in fails,
    fs_udp_create_groups() will free ft->g. However, its caller
    fs_udp_create_table() will free ft->g again through calling
    mlx5e_destroy_flow_table(), which will lead to a double-free.
    Fix this by setting ft->g to NULL in fs_udp_create_groups().
    
    Fixes: 1c80bd684388 ("net/mlx5e: Introduce Flow Steering UDP API")
    Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
    Reviewed-by: Tariq Toukan <tariqt@xxxxxxxxxx>
    Reviewed-by: Simon Horman <horms@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/fs_tt_redirect.c b/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
index 7aa25a5e29d73..b26edbc53cad2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
@@ -156,6 +156,7 @@ static int fs_udp_create_groups(struct mlx5e_flow_table *ft, enum fs_udp_type ty
 	in = kvzalloc(inlen, GFP_KERNEL);
 	if  (!in || !ft->g) {
 		kfree(ft->g);
+		ft->g = NULL;
 		kvfree(in);
 		return -ENOMEM;
 	}




[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