Patch "net: sparx5: switchdev: fix possible NULL pointer dereference" 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

    net: sparx5: switchdev: fix possible NULL pointer dereference

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:
     net-sparx5-switchdev-fix-possible-null-pointer-deref.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 8e35140a580c3d98532f67168b9a828345b85ebe
Author: Zheng Yongjun <zhengyongjun3@xxxxxxxxxx>
Date:   Sat Mar 26 08:12:39 2022 +0000

    net: sparx5: switchdev: fix possible NULL pointer dereference
    
    [ Upstream commit 0906f3a3df07835e37077d8971aac65347f2ed57 ]
    
    As the possible failure of the allocation, devm_kzalloc() may return NULL
    pointer.
    Therefore, it should be better to check the 'db' in order to prevent
    the dereference of NULL pointer.
    
    Fixes: 10615907e9b51 ("net: sparx5: switchdev: adding frame DMA functionality")
    Signed-off-by: Zheng Yongjun <zhengyongjun3@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c b/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
index 7436f62fa152..174ad95e746a 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
@@ -420,6 +420,8 @@ static int sparx5_fdma_tx_alloc(struct sparx5 *sparx5)
 			db_hw->dataptr = phys;
 			db_hw->status = 0;
 			db = devm_kzalloc(sparx5->dev, sizeof(*db), GFP_KERNEL);
+			if (!db)
+				return -ENOMEM;
 			db->cpu_addr = cpu_addr;
 			list_add_tail(&db->list, &tx->db_list);
 		}



[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