Patch "ice: fix accounting if a VLAN already exists" has been added to the 6.8-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 accounting if a VLAN already exists

to the 6.8-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-accounting-if-a-vlan-already-exists.patch
and it can be found in the queue-6.8 subdirectory.

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



commit 623a231f07ce8203ca96aff87b0ba5c0436f2fe3
Author: Jacob Keller <jacob.e.keller@xxxxxxxxx>
Date:   Thu May 23 10:45:30 2024 -0700

    ice: fix accounting if a VLAN already exists
    
    [ Upstream commit 82617b9a04649e83ee8731918aeadbb6e6d7cbc7 ]
    
    The ice_vsi_add_vlan() function is used to add a VLAN filter for the target
    VSI. This function prepares a filter in the switch table for the given VSI.
    If it succeeds, the vsi->num_vlan counter is incremented.
    
    It is not considered an error to add a VLAN which already exists in the
    switch table, so the function explicitly checks and ignores -EEXIST. The
    vsi->num_vlan counter is still incremented.
    
    This seems incorrect, as it means we can double-count in the case where the
    same VLAN is added twice by the caller. The actual table will have one less
    filter than the count.
    
    The ice_vsi_del_vlan() function similarly checks and handles the -ENOENT
    condition for when deleting a filter that doesn't exist. This flow only
    decrements the vsi->num_vlan if it actually deleted a filter.
    
    The vsi->num_vlan counter is used only in a few places, primarily related
    to tracking the number of non-zero VLANs. If the vsi->num_vlans gets out of
    sync, then ice_vsi_num_non_zero_vlans() will incorrectly report more VLANs
    than are present, and ice_vsi_has_non_zero_vlans() could return true
    potentially in cases where there are only VLAN 0 filters left.
    
    Fix this by only incrementing the vsi->num_vlan in the case where we
    actually added an entry, and not in the case where the entry already
    existed.
    
    Fixes: a1ffafb0b4a4 ("ice: Support configuring the device to Double VLAN Mode")
    Signed-off-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@xxxxxxxxx>
    Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240523-net-2024-05-23-intel-net-fixes-v1-2-17a923e0bb5f@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
index 2e9ad27cb9d13..6e8f2aab60801 100644
--- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
@@ -45,14 +45,15 @@ int ice_vsi_add_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
 		return -EINVAL;
 
 	err = ice_fltr_add_vlan(vsi, vlan);
-	if (err && err != -EEXIST) {
+	if (!err)
+		vsi->num_vlan++;
+	else if (err == -EEXIST)
+		err = 0;
+	else
 		dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i, status %d\n",
 			vlan->vid, vsi->vsi_num, err);
-		return err;
-	}
 
-	vsi->num_vlan++;
-	return 0;
+	return err;
 }
 
 /**




[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