Linux X.25 subsystem development
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: lapbether: fix lock cycles reported by syzbot
@ 2026-11-25  4:59 Yu Gao
  2026-11-25  8:52 ` Martin Schiller
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Gao @ 2026-11-25  4:59 UTC (permalink / raw)
  To: Martin Schiller, netdev
  Cc: linux-x25, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Xie He, Hillf Danton,
	syzbot+059a2795ad4cff2a2695, syzbot+8328573e4d0514392471, Yu Gao

LAPB transmits frames through lapbeth_data_transmit() with lapb->lock
held, and lapb_unregister() takes lapb->lock with lapb_list_lock held
for writing. When the Ethernet device under a lapbeth device is a
tunnel (gretap or vxlan in the syzbot reproducers) whose packets are
routed through a lapbeth device, a frame sent by LAPB comes back into
lapbeth_xmit(), which runs under the TX lock of that device and takes
up_lock before calling into LAPB. LAPB then takes lapb_list_lock to
look up the device, which closes a cycle. lapbeth_rcv() also calls into
LAPB with up_lock held.

Patch 1 stops holding up_lock across calls into LAPB and removes it.
Closing the device now clears "up" and waits for lapbeth_xmit() and
lapbeth_rcv() with synchronize_net() before lapb_unregister(). This
fixes the lapb_data_received report.

Patch 2 makes lapbeth an LLTX device, so that the core no longer takes
the TX lock around lapbeth_xmit(). With patch 1 alone, the
lapb_connect_request reproducer still reports a cycle through
_xmit_X25. Patch 2 removes it.

Testing was done on QEMU with the syzbot config, with lockdep and
KASAN enabled:

- On an unpatched kernel, both C reproducers report a cycle within 15
  seconds. With both patches, neither reports anything in runs of 400
  and 600 seconds each.
- A functional test runs one lapbeth device over a veth pair, with the
  other end driven as a LAPB DCE from user space. It covers link setup
  and teardown from either side, about 100 frames from the peer and 370
  frames to the peer through lapbeth_xmit(), and closing the device
  mid-transfer. All frames arrive in order, and the output is identical
  with and without the series.
- 300 up/down cycles of a lapbeth device while frames are sent in both
  directions produce no warnings.
- A lapbeth device on a gretap tunnel whose remote address is routed
  back through the same lapbeth device: on an unpatched kernel, a SABM
  received through the tunnel deadlocks on up_lock when the UA comes
  back into lapbeth_xmit(). With the series, the looped IP packet is
  dropped, in three out of three runs. With an MPLS route instead
  (first byte 0x00), the T1 timer path deadlocks on lapb->lock with and
  without the series.

No end-to-end test with X.25 sockets was done.

Yu Gao (2):
  net: lapbether: don't hold up_lock while calling into LAPB
  net: lapbether: use lockless TX

 drivers/net/wan/lapbether.c | 42 ++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

-- 
2.54.0 (Apple Git-157)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25  8:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  4:59 [PATCH net 0/2] net: lapbether: fix lock cycles reported by syzbot Yu Gao
2026-11-25  8:52 ` Martin Schiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox