Patch "ice: fix invalid check for empty list in ice_sched_assoc_vsi_to_agg()" has been added to the 6.2-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

    ice: fix invalid check for empty list in ice_sched_assoc_vsi_to_agg()

to the 6.2-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:
     ice-fix-invalid-check-for-empty-list-in-ice_sched_as.patch
and it can be found in the queue-6.2 subdirectory.

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



commit 444fe60c00813d045e63e01996623d2da9472e12
Author: Jakob Koschel <jkl820.git@xxxxxxxxx>
Date:   Mon Mar 20 13:48:15 2023 +0100

    ice: fix invalid check for empty list in ice_sched_assoc_vsi_to_agg()
    
    [ Upstream commit e9a1cc2e4c4ee7c7e60fb26345618c2522a2a10f ]
    
    The code implicitly assumes that the list iterator finds a correct
    handle. If 'vsi_handle' is not found the 'old_agg_vsi_info' was
    pointing to an bogus memory location. For safety a separate list
    iterator variable should be used to make the != NULL check on
    'old_agg_vsi_info' correct under any circumstances.
    
    Additionally Linus proposed to avoid any use of the list iterator
    variable after the loop, in the attempt to move the list iterator
    variable declaration into the macro to avoid any potential misuse after
    the loop. Using it in a pointer comparison after the loop is undefined
    behavior and should be omitted if possible [1].
    
    Fixes: 37c592062b16 ("ice: remove the VSI info from previous agg")
    Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@xxxxxxxxxxxxxx/ [1]
    Signed-off-by: Jakob Koschel <jkl820.git@xxxxxxxxx>
    Tested-by: Arpana Arland <arpanax.arland@xxxxxxxxx> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c
index 6d08b397df2ad..8f0ea411dfba0 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.c
+++ b/drivers/net/ethernet/intel/ice/ice_sched.c
@@ -2787,7 +2787,7 @@ static int
 ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
 			   u16 vsi_handle, unsigned long *tc_bitmap)
 {
-	struct ice_sched_agg_vsi_info *agg_vsi_info, *old_agg_vsi_info = NULL;
+	struct ice_sched_agg_vsi_info *agg_vsi_info, *iter, *old_agg_vsi_info = NULL;
 	struct ice_sched_agg_info *agg_info, *old_agg_info;
 	struct ice_hw *hw = pi->hw;
 	int status = 0;
@@ -2805,11 +2805,13 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
 	if (old_agg_info && old_agg_info != agg_info) {
 		struct ice_sched_agg_vsi_info *vtmp;
 
-		list_for_each_entry_safe(old_agg_vsi_info, vtmp,
+		list_for_each_entry_safe(iter, vtmp,
 					 &old_agg_info->agg_vsi_list,
 					 list_entry)
-			if (old_agg_vsi_info->vsi_handle == vsi_handle)
+			if (iter->vsi_handle == vsi_handle) {
+				old_agg_vsi_info = iter;
 				break;
+			}
 	}
 
 	/* check if entry already exist */



[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