Patch "sfc: Check null pointer of rx_queue->page_ring" 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

    sfc: Check null pointer of rx_queue->page_ring

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:
     sfc-check-null-pointer-of-rx_queue-page_ring.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 91e28b3c2e54560582c59471c84dfc698d27ca1f
Author: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
Date:   Mon Dec 20 21:56:03 2021 +0800

    sfc: Check null pointer of rx_queue->page_ring
    
    [ Upstream commit bdf1b5c3884f6a0dc91b0dbdb8c3b7d205f449e0 ]
    
    Because of the possible failure of the kcalloc, it should be better to
    set rx_queue->page_ptr_mask to 0 when it happens in order to maintain
    the consistency.
    
    Fixes: 5a6681e22c14 ("sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver")
    Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
    Acked-by: Martin Habets <habetsm.xilinx@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20211220135603.954944-1-jiasheng@xxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c
index 68fc7d317693b..0983abc0cc5f0 100644
--- a/drivers/net/ethernet/sfc/rx_common.c
+++ b/drivers/net/ethernet/sfc/rx_common.c
@@ -150,7 +150,10 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
 					    efx->rx_bufs_per_page);
 	rx_queue->page_ring = kcalloc(page_ring_size,
 				      sizeof(*rx_queue->page_ring), GFP_KERNEL);
-	rx_queue->page_ptr_mask = page_ring_size - 1;
+	if (!rx_queue->page_ring)
+		rx_queue->page_ptr_mask = 0;
+	else
+		rx_queue->page_ptr_mask = page_ring_size - 1;
 }
 
 static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue)



[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