Patch "igb: Check if num of q_vectors is smaller than max before array access" has been added to the 5.13-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

    igb: Check if num of q_vectors is smaller than max before array access

to the 5.13-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:
     igb-check-if-num-of-q_vectors-is-smaller-than-max-be.patch
and it can be found in the queue-5.13 subdirectory.

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



commit 9625a5ce2e87d6acaaf4618e14414055906bbb1d
Author: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>
Date:   Thu Apr 22 10:19:23 2021 +0000

    igb: Check if num of q_vectors is smaller than max before array access
    
    [ Upstream commit 6c19d772618fea40d9681f259368f284a330fd90 ]
    
    Ensure that the adapter->q_vector[MAX_Q_VECTORS] array isn't accessed
    beyond its size. It was fixed by using a local variable num_q_vectors
    as a limit for loop index, and ensure that num_q_vectors is not bigger
    than MAX_Q_VECTORS.
    
    Fixes: 047e0030f1e6 ("igb: add new data structure for handling interrupts and NAPI")
    Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>
    Reviewed-by: Grzegorz Siwik <grzegorz.siwik@xxxxxxxxx>
    Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@xxxxxxxxx>
    Reviewed-by: Slawomir Laba <slawomirx.laba@xxxxxxxxx>
    Reviewed-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@xxxxxxxxx>
    Reviewed-by: Mateusz Palczewski <mateusz.placzewski@xxxxxxxxx>
    Tested-by: Tony Brelinski <tonyx.brelinski@xxxxxxxxx>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a371c51a3fe8..9f83ff55394c 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -931,6 +931,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
  **/
 static int igb_request_msix(struct igb_adapter *adapter)
 {
+	unsigned int num_q_vectors = adapter->num_q_vectors;
 	struct net_device *netdev = adapter->netdev;
 	int i, err = 0, vector = 0, free_vector = 0;
 
@@ -939,7 +940,13 @@ static int igb_request_msix(struct igb_adapter *adapter)
 	if (err)
 		goto err_out;
 
-	for (i = 0; i < adapter->num_q_vectors; i++) {
+	if (num_q_vectors > MAX_Q_VECTORS) {
+		num_q_vectors = MAX_Q_VECTORS;
+		dev_warn(&adapter->pdev->dev,
+			 "The number of queue vectors (%d) is higher than max allowed (%d)\n",
+			 adapter->num_q_vectors, MAX_Q_VECTORS);
+	}
+	for (i = 0; i < num_q_vectors; i++) {
 		struct igb_q_vector *q_vector = adapter->q_vector[i];
 
 		vector++;



[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