Patch "r8169: fix potential skb double free in an error path" has been added to the 5.9-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

    r8169: fix potential skb double free in an error path

to the 5.9-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:
     r8169-fix-potential-skb-double-free-in-an-error-path.patch
and it can be found in the queue-5.9 subdirectory.

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



commit b825ea2a4efa8779d5ebefdd13cbae4373030eb6
Author: Heiner Kallweit <hkallweit1@xxxxxxxxx>
Date:   Thu Nov 5 15:28:42 2020 +0100

    r8169: fix potential skb double free in an error path
    
    [ Upstream commit cc6528bc9a0c901c83b8220a2e2617f3354d6dd9 ]
    
    The caller of rtl8169_tso_csum_v2() frees the skb if false is returned.
    eth_skb_pad() internally frees the skb on error what would result in a
    double free. Therefore use __skb_put_padto() directly and instruct it
    to not free the skb on error.
    
    Fixes: b423e9ae49d7 ("r8169: fix offloaded tx checksum for small packets.")
    Reported-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
    Link: https://lore.kernel.org/r/f7e68191-acff-9ded-4263-c016428a8762@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index c74d9c02a805f..ed918c12bc5e9 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4145,7 +4145,8 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
 		opts[1] |= transport_offset << TCPHO_SHIFT;
 	} else {
 		if (unlikely(skb->len < ETH_ZLEN && rtl_test_hw_pad_bug(tp)))
-			return !eth_skb_pad(skb);
+			/* eth_skb_pad would free the skb on error */
+			return !__skb_put_padto(skb, ETH_ZLEN, false);
 	}
 
 	return true;



[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