Skip to content

Commit 96d8d0f

Browse files
committed
r8169: Fix possible ring buffer corruption on fragmented Tx packets.
jira LE-2157 cve CVE-2024-38586 Rebuild_History Non-Buildable kernel-5.14.0-503.14.1.el9_5 commit-author Ken Milmore <[email protected]> commit c71e3a5 An issue was found on the RTL8125b when transmitting small fragmented packets, whereby invalid entries were inserted into the transmit ring buffer, subsequently leading to calls to dma_unmap_single() with a null address. This was caused by rtl8169_start_xmit() not noticing changes to nr_frags which may occur when small packets are padded (to work around hardware quirks) in rtl8169_tso_csum_v2(). To fix this, postpone inspecting nr_frags until after any padding has been applied. Fixes: 9020845 ("r8169: improve rtl8169_start_xmit") Cc: [email protected] Signed-off-by: Ken Milmore <[email protected]> Reviewed-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit c71e3a5) Signed-off-by: Jonathan Maple <[email protected]>
1 parent ffedd31 commit 96d8d0f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4462,11 +4462,11 @@ static void rtl8169_doorbell(struct rtl8169_private *tp)
44624462
static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
44634463
struct net_device *dev)
44644464
{
4465-
unsigned int frags = skb_shinfo(skb)->nr_frags;
44664465
struct rtl8169_private *tp = netdev_priv(dev);
44674466
unsigned int entry = tp->cur_tx % NUM_TX_DESC;
44684467
struct TxDesc *txd_first, *txd_last;
44694468
bool stop_queue, door_bell;
4469+
unsigned int frags;
44704470
u32 opts[2];
44714471

44724472
if (unlikely(!rtl_tx_slots_avail(tp))) {
@@ -4489,6 +4489,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
44894489

44904490
txd_first = tp->TxDescArray + entry;
44914491

4492+
frags = skb_shinfo(skb)->nr_frags;
44924493
if (frags) {
44934494
if (rtl8169_xmit_frags(tp, skb, opts, entry))
44944495
goto err_dma_1;

0 commit comments

Comments
 (0)