Thread (3 messages) 3 messages, 1 author, 2d ago
DORMANTno replies

[PATCH net 0/2] 8139cp: fix two TX error handling bugs

From: Yun Lu <hidden>
Date: 2026-07-17 10:38:02

From: Yun Lu <redacted>

Hi,

This short series fixes two bugs in the transmit error handling of
the 8139cp driver. Both are only reachable when DMA mapping or
memory allocation fails, but each can take the kernel down when
triggered.

The first patch rewrites the DMA mapping unwind in cp_start_xmit().
When mapping a TX fragment fails, the current helper unmaps the
stale address found in the not-yet-written head descriptor slot,
which is a double unmap of a previously completed mapping; the
fragment unmaps use sizes shifted by one slot; and the head buffer
mapping is never unmapped at all, leaking one DMA mapping per
failure.

The second patch makes cp_tx_timeout() handle cp_init_rings()
failure. If the RX buffer refill fails there, the ring is left
empty, but the driver restarts the hardware and schedules NAPI
anyway, so cp_rx_poll() dereferences a NULL rx_skb slot and hits
BUG_ON(!skb). Bail out and leave the device down until the next
open instead.

Thanks,
Yun

Yun Lu (2):
  8139cp: fix DMA mapping unwind on TX frag map failure
  8139cp: handle cp_init_rings() failure in cp_tx_timeout()

 drivers/net/ethernet/realtek/8139cp.c | 31 +++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help