Patch "e100: Fix possible use after free in e100_xmit_prepare" has been added to the 4.19-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

    e100: Fix possible use after free in e100_xmit_prepare

to the 4.19-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:
     e100-fix-possible-use-after-free-in-e100_xmit_prepar.patch
and it can be found in the queue-4.19 subdirectory.

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



commit a1e41203f9c5cce24b449e4ac361aaad5948f182
Author: Wang Hai <wanghai38@xxxxxxxxxx>
Date:   Wed Nov 16 01:24:07 2022 +0800

    e100: Fix possible use after free in e100_xmit_prepare
    
    [ Upstream commit 45605c75c52c7ae7bfe902214343aabcfe5ba0ff ]
    
    In e100_xmit_prepare(), if we can't map the skb, then return -ENOMEM, so
    e100_xmit_frame() will return NETDEV_TX_BUSY and the upper layer will
    resend the skb. But the skb is already freed, which will cause UAF bug
    when the upper layer resends the skb.
    
    Remove the harmful free.
    
    Fixes: 5e5d49422dfb ("e100: Release skb when DMA mapping is failed in e100_xmit_prepare")
    Signed-off-by: Wang Hai <wanghai38@xxxxxxxxxx>
    Reviewed-by: Alexander Duyck <alexanderduyck@xxxxxx>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index c0c30463d214..ec5dc61b879e 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -1745,11 +1745,8 @@ static int e100_xmit_prepare(struct nic *nic, struct cb *cb,
 	dma_addr = dma_map_single(&nic->pdev->dev, skb->data, skb->len,
 				  DMA_TO_DEVICE);
 	/* If we can't map the skb, have the upper layer try later */
-	if (dma_mapping_error(&nic->pdev->dev, dma_addr)) {
-		dev_kfree_skb_any(skb);
-		skb = NULL;
+	if (dma_mapping_error(&nic->pdev->dev, dma_addr))
 		return -ENOMEM;
-	}
 
 	/*
 	 * Use the last 4 bytes of the SKB payload packet as the CRC, used for



[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