Netdev List
 help / color / mirror / Atom feed
From: Yu Gao <SuperSkidder@qq.com>
To: Martin Schiller <ms@dev.tdt.de>, netdev@vger.kernel.org
Cc: linux-x25@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Xie He <xie.he.0141@gmail.com>, Hillf Danton <hdanton@sina.com>,
	syzbot+059a2795ad4cff2a2695@syzkaller.appspotmail.com,
	syzbot+8328573e4d0514392471@syzkaller.appspotmail.com,
	Yu Gao <SuperSkidder@qq.com>
Subject: [PATCH net 0/2] net: lapbether: fix lock cycles reported by syzbot
Date: Wed, 25 Nov 2026 12:59:07 +0800	[thread overview]
Message-ID: <tencent_AD34C10B65771ADD86725F3221EE31778507@qq.com> (raw)

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)


             reply	other threads:[~2026-11-25  4:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  4:59 Yu Gao [this message]
2026-11-25  8:52 ` [PATCH net 0/2] net: lapbether: fix lock cycles reported by syzbot Martin Schiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_AD34C10B65771ADD86725F3221EE31778507@qq.com \
    --to=superskidder@qq.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hdanton@sina.com \
    --cc=kuba@kernel.org \
    --cc=linux-x25@vger.kernel.org \
    --cc=ms@dev.tdt.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+059a2795ad4cff2a2695@syzkaller.appspotmail.com \
    --cc=syzbot+8328573e4d0514392471@syzkaller.appspotmail.com \
    --cc=xie.he.0141@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox