Article View: linux.kernel.netdev
Article #27458Re: [PATCH net v3 2/3] net: lapbether: bound the receive queue
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 17:39
Date: Sat, 05 Dec 2026 17:39
160 lines
13596 bytes
13596 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new limit check in lapbeth_rcv()
(drivers/net/wan/lapbether.c) runs before lapb_data_received() and…
- [Medium] The patch is titled 'bound the receive queue', but the bound
only applies to indications that start in lapbeth_rcv().
--
net: lapbether: bound the receive queue
This patch drops received frames in lapbeth_rcv() once lapbeth->rx_queue
reaches netdev_max_backlog, so a peer cannot grow the queue without limit.
It also purges rx_queue in lapbeth_close(), so stale entries don't count
against the limit after the device is reopened.
> diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
> index c3630a82913bf..ab71afaaf8482 100644
> --- a/drivers/net/wan/lapbether.c
> +++ b/drivers/net/wan/lapbether.c
[ ... ]
> @@ -132,6 +133,16 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev,
> if (!lapbeth->up)
> goto drop_unlock;
>
> + /* A frame dropped before LAPB sees it is like one lost on the wire,
> + * and the peer retransmits it. This keeps a peer from growing
> + * rx_queue without limit.
> + */
> + if (skb_queue_len_lockless(&lapbeth->rx_queue) >=
> + READ_ONCE(net_hotdata.max_backlog)) {
> + DEV_STATS_INC(lapbeth->axdev, rx_dropped);
> + goto drop_unlock;
> + }
[Severity: Medium]
Does this comment hold for every frame type dropped here? The check runs
before lapb_data_received(), so while rx_queue is full LAPB sees no
incoming frames at all. That includes I-frames carrying N(R) acks,
RR/RNR/REJ, UA, DM and FRMR responses, and SABM/DISC.
The peer only retransmits its own I-frames and commands. It won't resend
acks or responses that we dropped. Only our local T1 recovers those, and
each T1 expiry in state 3 increments n2count:
net/lapb/lapb_timer.c:lapb_t1timer_expiry() {
...
case LAPB_STATE_3:
if (lapb->n2count == lapb->n2) {
lapb_clear_queues(lapb);
lapb->state = LAPB_STATE_0;
lapb_stop_t2timer(lapb);
lapb_disconnect_indication(lapb, LAPB_TIMEDOUT);
...
}
Because the peer's acks are thrown away, the local TX window also stalls.
Under sustained congestion, can this reset the local link and tear down
every X.25 call?
The commit message also describes this as "the limit netif_rx() applied
before the commit below". Before 514e1150da9c, that limit was applied
after LAPB had parsed the frame. lapbeth_data_indication() returned the
NET_RX_DROP verdict, and lapb_state3_machine() had already processed N(R)
by then. It only skipped the V(R) advance:
net/lapb/lapb_in.c:lapb_state3_machine() {
...
if (lapb->condition & LAPB_PEER_RX_BUSY_CONDITION)
lapb_frames_acked(lapb, frame->nr);
else
lapb_check_iframes_acked(lapb, frame->nr);
if (frame->ns == lapb->vr) {
int cn;
cn = lapb_data_indication(lapb, skb);
queued = 1;
...
if (cn == NET_RX_DROP) {
pr_debug("rx congestion\n");
break;
}
...
}
With that mechanism only the inbound I-frame is deferred, and the peer
retransmits it. That is the behaviour the new comment and the commit
message describe.
Would it work better to apply the limit in lapbeth_data_indication() and
return NET_RX_DROP there, so LAPB's existing congestion handling is used?
If not, could the comment and commit message be changed to describe what
this check actually does?
The later patches in this series don't touch lapbeth_rcv(), so this stays
the same at the end of the series.
[Severity: Medium]
Does this bound cover every producer of rx_queue? lapbeth_connected() and
lapbeth_disconnected() still queue on rx_queue with no length check:
drivers/net/wan/lapbether.c:lapbeth_connected() {
...
skb->protocol = x25_type_trans(skb, dev);
skb_queue_tail(&lapbeth->rx_queue, skb);
napi_schedule(&lapbeth->napi);
}
lapbeth_xmit() reaches both of them without going through lapbeth_rcv():
drivers/net/wan/lapbether.c:lapbeth_xmit() {
...
case X25_IFACE_CONNECT:
err = lapb_connect_request(dev);
if (err == LAPB_CONNECTED)
lapbeth_connected(dev, LAPB_OK);
...
case X25_IFACE_DISCONNECT:
err = lapb_disconnect_request(dev);
if (err == LAPB_NOTCONNECTED)
lapbeth_disconnected(dev, LAPB_OK);
...
}
lapb_connect_request() returns LAPB_CONNECTED on every call while LAPB is
in state 3 or 4. A disconnect request returns LAPB_NOTCONNECTED while LAPB
is in state 0.
So a sender with CAP_NET_RAW and a packet socket on the lapb device can
queue one indication per 1-byte frame it transmits, from several CPUs at
once. Meanwhile lapbeth_napi_poll() drains at most 16 skbs per poll, on
one CPU.
Before 514e1150da9c these indications went through netif_rx() and were
capped by netdev_max_backlog. The rest of the series doesn't change
lapbeth_xmit(), lapbeth_connected() or lapbeth_disconnected().
Would moving the check to the enqueue point, in the indication callbacks,
bound every producer?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-lapb-unlock-v3-v3-0-65b6ce65141b%40qq.com
Technical Details
Message-ID:
<179649235448.3146.5216638636094775268@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378082-linux-kernel-netdev=dewy.ruReferences:
<20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378082-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 2/3] net: lapbether: bound the receive queue Date: Sat, 05 Dec 2026 17:39:14 +0000 Organization: Usenet Network Message-ID: <179649235448.3146.5216638636094775268@kernel.org> References: <20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3081823"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:TBLRZEflaOvvWmldDDFr8LgKUJA= sha256:WZiTfhm2p/5nbuRIeHoHMtbN51uhaCSiHVsJOzV7T5I= sha1:NFlSMYH52Zi4gbD3MxowANAXEbw= sha256:arRlcMHw+k23yMeXHbd/l7sW2Da/kxWjVXp/nB8p9+8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 269E0117E81; Sat, 5 Dec 2026 20:39:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.539 X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DX0rkuNoN0Kr; Sat, 5 Dec 2026 20:39:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378082-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 45968117E7C; Sat, 5 Dec 2026 20:39:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 6BC9C2B4EF; Sat, 5 Dec 2026 17:39:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796492357; b=2cCDd3ngURHOClQefU3NMk+1l55qlh7+AIWrKNtZMzfX9Bpy0bfWBZ1JmyHiRJH8OsX/ fntINdwS72IBtkm1shEr/aNz9ak4n3sLGlvH7OIUlSMLrdownoU1ZiQmQt64VrLaMzDzZ pOQ4WAAzCnlcFbCj/s2fFEzJoYOrivcbUbPRb6zH/xMecO1Nb/NNnLKgNF0ed0GDTmqfc l+e+BbCKhYCNjUIlwTnCpVBysu4C+NTfcy/m5jlr/aXIRmsqT+Rkw4anX3Uh/Bf4gXjiu Y012y4+GYt5Oo0LnPjjBD8MzwOtxcHdPwiRH34AvM34sl9hjS0X0BIc4jBrfwzMhvUQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796492357; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=vP4xMs6yYM6Vq9hFhYkOY/vyInOamxYf1ohmyagEoLg=; b=oiHkVQw4++H8CIU+YAJBtYMQ7OZeg73jZ5LDqsWjdkit2xhEAfRjw9guxFui0FKsZgWG 9Jx1WkgPqCnDDEqgdcUtTzEUazS5f/F6BaTHylv2aai5EjNBmHVZ2EaFuwHkmcfGQg3ly vgL7VJbm/Lzqm7zUcG/4wbAjDcsKGyxadbh5BzO3c7FpGFVkrjWAOjq6Fk6wNbhhl4omZ HHExs0duamDgUbkC7UUUyhWpXOQg5KDjTwd1nXT3TAjStdHb+ordCQqxYMLgGsoOln824 P6hR0QtezAVsGPyt3H1T89DHgdT+P0xOxCjphKY78sNLXdDX1Hix+4R48veb0QEB+kg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bmf2QDDs; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE94D606A337; Sat, 5 Dec 2026 17:39:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bmf2QDDs X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796492356; b=1uY4O43I8DehWxY7bCaU1q6svHmRzQsVy7rLnyMLUHQ96uT16WX2/EHKmIVg6VXyfA/2 o5JyH5SYTFNt5ipb4Z5XDKAKgZQE4llr5SUqLUjaBxMnP/sLXDpVrUwM6DxozSGga5VCZ OA/G9vu2tFvriUQn+xO2FYKEEJGJOA9LJg9brGaYyW6jWhNd81Vsr6zgypDWuImq8LaQO yieKPJITGzxISoKproXTg9RSlIQ50mqMqvYtMTLeYaYwxjrigkPcRFnEBA8HS4WwDc/6L ED/hjzJHYT2sfTQXIqvFQOp8ycwkBcEFZgrhMlzAm7YRvfDsHeoa9ZIH142a7JMeH/g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796492356; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=vP4xMs6yYM6Vq9hFhYkOY/vyInOamxYf1ohmyagEoLg=; b=g6GMEMZ9AyA4A2RwNXjmTmcDB9D5q1fvIXcI1kmxWDfiw44fg2TC7hc8xSFJvWun5qvC nrS8FCXUKDXnGgHyGjvH4H9KMjPaptqMf2SvpSy25XnyraCCI7T6n3aYV9wVEHwtg3pJ5 qhWn9BcR04u2K5a7uWhpY5mrFOIEgtLSDsT2n+3oJY8lhuEbApInoe56fAPMXB8ezBmQs LCJwyDOhC56TSiRn4sRjK06bvof2+ap5iLVXESVYNoUGGiHKGSx/7Lco7QHh1swXfAT7x cvEOuSyBQKavqpctrvNKhVCvpIXQzk0ZGZqLZRCi+Zdwol9v+jB8rbGAaof1AgtEsgg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bmf2QDDs; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A9CB606A31F; Sat, 5 Dec 2026 17:39:15 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E46131F00A07; Sat, 5 Dec 2026 17:39:14 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796492355; bh=vP4xMs6yYM6Vq9hFhYkOY/vyInOamxYf1ohmyagEoLg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Bmf2QDDsCvpKrIIBDmbfZqJeuHVjs8hoD09K38EvysgJT/VnRiZQBNgayjX3urovR KvOS6KvqqYW/K9Pg/jWT1T3Pn+0oLkx3uuHSRqWXVidrREH8o/j9ILCG02BnSA6iW1 YF8x65t5T4BlzU9yZhXaoPe3o/DlwMTtaKAnH7xyfA3N7PCeA2q3AiiMvwfPQzKhn4 q7AmevJMOXq6V7WjZvMQL0U2TMaylF18UwD65TscUYu4CvMwwElLURDVSjMIPRKRcF wnVU1szuKqSn1vWluegHxgnvpndtwW4kU2b7+j4rjzyR7IkE8U8f4N+EJKzJ8Rmj3L 0DM2VF3NBj9tw== X-Cc: ms@dev.tdt.de, netdev@vger.kernel.org, hdanton@sina.com, davem@davemloft.net, horms@kernel.org, xie.he.0141@gmail.com, andrew+netdev@lunn.ch, edumazet@kernel.org, corbet@lwn.net, willemb@google.com, syzbot+8328573e4d0514392471@syzkaller.appspotmail.com, linux-doc@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-x25@vger.kernel.org, syzbot+059a2795ad4cff2a2695@syzkaller.appspotmail.com X-In-Reply-To: <20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list