Patch "dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()" has been added to the 6.10-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

    dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()

to the 6.10-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:
     dpaa2-switch-fix-error-checking-in-dpaa2_switch_seed.patch
and it can be found in the queue-6.10 subdirectory.

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



commit 82a745183ce0a37eefc6e573b89912465cbbab21
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Sat Aug 17 09:52:46 2024 +0300

    dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()
    
    [ Upstream commit c50e7475961c36ec4d21d60af055b32f9436b431 ]
    
    The dpaa2_switch_add_bufs() function returns the number of bufs that it
    was able to add.  It returns BUFS_PER_CMD (7) for complete success or a
    smaller number if there are not enough pages available.  However, the
    error checking is looking at the total number of bufs instead of the
    number which were added on this iteration.  Thus the error checking
    only works correctly for the first iteration through the loop and
    subsequent iterations are always counted as a success.
    
    Fix this by checking only the bufs added in the current iteration.
    
    Fixes: 0b1b71370458 ("staging: dpaa2-switch: handle Rx path on control interface")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
    Reviewed-by: Ioana Ciornei <ioana.ciornei@xxxxxxx>
    Tested-by: Ioana Ciornei <ioana.ciornei@xxxxxxx>
    Link: https://patch.msgid.link/eec27f30-b43f-42b6-b8ee-04a6f83423b6@stanley.mountain
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index a71f848adc054..a293b08f36d46 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -2638,13 +2638,14 @@ static int dpaa2_switch_refill_bp(struct ethsw_core *ethsw)
 
 static int dpaa2_switch_seed_bp(struct ethsw_core *ethsw)
 {
-	int *count, i;
+	int *count, ret, i;
 
 	for (i = 0; i < DPAA2_ETHSW_NUM_BUFS; i += BUFS_PER_CMD) {
+		ret = dpaa2_switch_add_bufs(ethsw, ethsw->bpid);
 		count = &ethsw->buf_count;
-		*count += dpaa2_switch_add_bufs(ethsw, ethsw->bpid);
+		*count += ret;
 
-		if (unlikely(*count < BUFS_PER_CMD))
+		if (unlikely(ret < BUFS_PER_CMD))
 			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