Patch "net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list()" 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 slab-out-of-bounds in mlx5_query_nic_vport_mac_list()

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-slab-out-of-bounds-in-mlx5_query_nic_v.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 ca5d67667297d5dbf9538e2d863c357dce13c80c
Author: Shifeng Li <lishifeng@xxxxxxxxxxxxxx>
Date:   Thu Nov 30 01:46:56 2023 -0800

    net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list()
    
    [ Upstream commit ddb38ddff9c71026bad481b791a94d446ee37603 ]
    
    Out_sz that the size of out buffer is calculated using query_nic_vport
    _context_in structure when driver query the MAC list. However query_nic
    _vport_context_in structure is smaller than query_nic_vport_context_out.
    When allowed_list_size is greater than 96, calling ether_addr_copy() will
    trigger an slab-out-of-bounds.
    
    [ 1170.055866] BUG: KASAN: slab-out-of-bounds in mlx5_query_nic_vport_mac_list+0x481/0x4d0 [mlx5_core]
    [ 1170.055869] Read of size 4 at addr ffff88bdbc57d912 by task kworker/u128:1/461
    [ 1170.055870]
    [ 1170.055932] Workqueue: mlx5_esw_wq esw_vport_change_handler [mlx5_core]
    [ 1170.055936] Call Trace:
    [ 1170.055949]  dump_stack+0x8b/0xbb
    [ 1170.055958]  print_address_description+0x6a/0x270
    [ 1170.055961]  kasan_report+0x179/0x2c0
    [ 1170.056061]  mlx5_query_nic_vport_mac_list+0x481/0x4d0 [mlx5_core]
    [ 1170.056162]  esw_update_vport_addr_list+0x2c5/0xcd0 [mlx5_core]
    [ 1170.056257]  esw_vport_change_handle_locked+0xd08/0x1a20 [mlx5_core]
    [ 1170.056377]  esw_vport_change_handler+0x6b/0x90 [mlx5_core]
    [ 1170.056381]  process_one_work+0x65f/0x12d0
    [ 1170.056383]  worker_thread+0x87/0xb50
    [ 1170.056390]  kthread+0x2e9/0x3a0
    [ 1170.056394]  ret_from_fork+0x1f/0x40
    
    Fixes: e16aea2744ab ("net/mlx5: Introduce access functions to modify/query vport mac lists")
    Cc: Ding Hui <dinghui@xxxxxxxxxxxxxx>
    Signed-off-by: Shifeng Li <lishifeng@xxxxxxxxxxxxxx>
    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/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
index 4c1440a95ad75..0478e5ecd4913 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
@@ -277,7 +277,7 @@ int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
 		req_list_size = max_list_size;
 	}
 
-	out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_in) +
+	out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_out) +
 			req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
 
 	out = kzalloc(out_sz, GFP_KERNEL);




[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