Article View: linux.kernel.netdev
Article #25381[PATCH net v3 2/3] net: lapbether: bound the receive queue
From: Yu Gao via B4 Relay
Date: Tue, 01 Dec 2026 17:18
Date: Tue, 01 Dec 2026 17:18
61 lines
12694 bytes
12694 bytes
From: Yu Gao <SuperSkidder@qq.com>
lapbeth queues LAPB's indications on rx_queue and passes them up from
its NAPI poll. Nothing limits that queue, so it grows when a peer
makes LAPB produce indications faster than the poll delivers them.
The transmit change later in this series makes that easier to hit.
Drop received frames in lapbeth_rcv() once the queue reaches
netdev_max_backlog, the limit netif_rx() applied before the commit
below. The frame is dropped before LAPB sees it, so the peer retransmits
it and nothing LAPB has accepted is lost. Purge the queue on close, so
stale entries don't count against the limit after the device is
reopened.
Fixes: 514e1150da9c ("net: x25: Queue received packets in the drivers instead of per-CPU queues")
Signed-off-by: Yu Gao <SuperSkidder@qq.com>
---
drivers/net/wan/lapbether.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index c3630a8..ab71afa 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -39,6 +39,7 @@
#include <linux/lapb.h>
#include <linux/init.h>
+#include <net/hotdata.h>
#include <net/netdev_lock.h>
#include <net/x25device.h>
@@ -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;
+ }
+
len = skb->data[0] + skb->data[1] * 256;
dev->stats.rx_packets++;
dev->stats.rx_bytes += len;
@@ -352,6 +363,7 @@ static int lapbeth_close(struct net_device *dev)
pr_err("lapb_unregister error: %d\n", err);
napi_disable(&lapbeth->napi);
+ skb_queue_purge(&lapbeth->rx_queue);
return 0;
}
--
Git-157)
Technical Details
Message-ID:
<20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375236-linux-kernel-netdev=dewy.ruReferences:
<20261202-lapb-unlock-v3-v3-0-65b6ce65141b@qq.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375236-linux-kernel-netdev=dewy.ru From: devnull+SuperSkidder.qq.com@kernel.org (Yu Gao via B4 Relay) Newsgroups: linux.kernel.netdev Subject: [PATCH net v3 2/3] net: lapbether: bound the receive queue Date: Wed, 02 Dec 2026 01:18:17 +0800 Organization: Usenet Network Message-ID: <20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com> References: <20261202-lapb-unlock-v3-v3-0-65b6ce65141b@qq.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1775843"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:12vrNiT6vhkompAhugDhxehn6/w= sha256:lFoh6ONMINRpXVXT8stGtfqPxzh/0TAu+jvM04Rq+No= sha1:rpjQU/ncsqTtwC5vob7YZHgzUfM= sha256:V+FZyYS1VmTzEe/1Aa3ZMLx26RUmDzDyIwH6YesgY90= 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 4ECF111737D; Tue, 1 Dec 2026 20:18:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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] 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 FWYuFJH7TShd; Tue, 1 Dec 2026 20:18:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375236-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 689B911742B; Tue, 1 Dec 2026 20:18:39 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 74744233CF; Tue, 1 Dec 2026 17:18:37 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796145513; b=0f1uxd7c6qbvIr5P6DXwzNsL0+D5p/RuEUt6H4XYgWIWZLyO14rx4lyiDXPfmpRVYqBJ JI4FguyW8ovFzlEJWUL5cgTIUiHlaVc3to016s2utVjfR8o5YCHZBk5Iakgvz75tQXEYv oFzPNXRC8epz0/jO+pQF7fvCb027SyehKLn5VRijN3wdD9aD2B8v2XMCDtc5frSJeXbKQ t+a9xvovBDxXTogjK7J8jqVTVKW2bZBhaEQPjW4MRXNZuN3RGkEGn85sJyfqvVqhrSS6A 1iiPn4Jir5fUSvDOLiY03rcOW/PmqFAJUVf2IwFIsMMD8vGhsyx8IB5kvJT+5NyYfSQ== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796145513; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=dsBK/hT6qT6nqBrwSMCxjVX84bKETvJv30Sv19HhhKo=; b=Leo3QUetrC7W0c9NvIjKzbRxvm8jJSqqelHosyVq8Rd9V1bH2nukMQuy+liFvHqvEWHK To58lVOrx17O4pZejGedRKIae6SHKd8erdk37OHVWiHoq5koPZsAZxIVDbjViMtb4h2er V1nwQ1wvnQOr/88l7cSpxNQzYvA/W29COkZyLFgwVgRNvGd7npHJIYakvJHC0oHOnOmBQ LMbau51DyOcpMwiC/yo43bMdGBvJu3138q8UDjdIFpzJlLzExrLcZq/14m7u57tM5VSq8 NIEkAl85zmfif0tLdoM2Oi/8lHSzLS/elgUIbXl1Rw/xXbb+TuwcI2/fPRNzp1qStWg== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QxLitFed; 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 3EFB1606A33A; Tue, 1 Dec 2026 17:18:33 +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=QxLitFed X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796145512; b=tb2gGmm6WkLvQlpboVkY/xx+kvAf341xmyD7qzxDuXe68q7yOkJ7Pcl7l7zj+CJgHtE3 lPyFYzb7ZAhAYiGCDEoBFfeUIPxK9ZSOnnbeTNNoCOjv0A28oMK5D+a4w/jHr8dVjSSpx RmJ89Dr4d00JJ7SWbiayTpJRjYL2SDgC4cBm98jKj6ZKPO6zHtD494LQlGbTTYxjDdAJs w0KzrUNWtPW/811xFVpBYGtP9XG4iosRoaznQBkHjOaislLCNjGIpRUHTGorolB1Nm87g Syl13rlS7x85wwvhucDCyiNjHB5Wpao2MtM9Ii3+R6Tuskx+qUkUYEke/Q0ICL1a1dA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796145512; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=dsBK/hT6qT6nqBrwSMCxjVX84bKETvJv30Sv19HhhKo=; b=PsKlIFBOoBixFo4laTIjEJuNYqrE+n4RDT+TrbZIJbvrRk4aAQ1hRNo9VbG9lUotXMWn CTtN0c5fAxY3uodGuCuq9fOfgS0raqb+h7r1zuhrUDrShYHKtdgF18G4NnrFfVNP9/zsh jp51takW7phix4YAZk2ZZkqvXMvQ5E3H8lIVdDXZEIehXYdufuuADgaALpA7a0R1KhS80 hAHjqzu411czt3tff67lp/GRsc8rDcYGTm3yuc/letxSG6XxhhW3696FlkERK3PcJ5nD/ IpG8gRz5UntQAYbtnHfej+NlUGJQzaliwnaXu5jieGZ7NUulsE9SQ595BT4tkPIK/cA== 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=QxLitFed; arc=pass header.oldest-pass=0 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 5500F606A320; Tue, 1 Dec 2026 17:18:32 +0000 (UTC) X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796145511; b=PDWOSfPWUDbTnKj0dEPjLQzTDnLLB4rSLDAHucmq96Bae2OzsETcVs+WE5GedsiZJCDF Ho9oqmhYgIDehY8KDFdsjvvuGSgO3j7TXxQN4IdZcql3pQnMtBYHvQTAgmkeNymokHbaJ er+gJiEFR2uW0tlu1N+VT8l9OnxDWCJrevBFLE/6EIhsdS7UFbw7hnc+wGm5+Eh6o8GF0 hf+b1L45tfUUP6z9t1BjNjxjcunT6J+8ZPA1+tdf/eGlBwMKsZnVn3/3xJ26L5Dw60lTr yksGKLTJrNbPhRnUIQX61ZRnVaz8e/w/+IdfFoLmerPIGtJQqOUjKC2x/4COaVodMnA== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796145511; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=dsBK/hT6qT6nqBrwSMCxjVX84bKETvJv30Sv19HhhKo=; b=gfXLL2Uqdle2RpMJDMg4MStNXHTOlHKaxEHI9UbwVSnfcz+hE2UbuwDtyX/7YGie0yhU 7qsGTtC8RtEZfapnnx2PnothFKgy7Wj2wsb5SU45xfWsZz9vX145luJGwGQJLK5PfUpsa 3cjkm5JR5cLCJ3RUAUOjwoS0f1RuU82P8jom9sdvNGdxwQOObJbq1VeqaTUak/F9T/dkp s48wBRH0d3RZJ3zzbgEjRCNt7tHeaIDW2h8C81/BvxKjV+4crtkNcNERL3uXde+0cRMt1 QLEPTHFohB0DqlMtT/fjt/XwpszY1hv1O2oF/PPD8rMW2bPVsHULit+Dyr/4JiN8vcw== X-ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 268E41F000C1; Tue, 1 Dec 2026 17:18:24 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796145511; bh=dsBK/hT6qT6nqBrwSMCxjVX84bKETvJv30Sv19HhhKo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=QxLitFedRPH8Joa/zRycfQp4MxHOCiUycdUxiJFMAENKqu6mUQDYxnGmo9wpCqNRQ Ptkr4oDyFquPNPxgJvG4rCHkp9GTkh3mZfFTrfhAkyUAw83AY0drPFD4xfKRfoNpZj eUWnC9fd2hvWGYkwjYxJBnG5PFMknEGK9TR4H9SG4z20jj+rCn6Rpm5xYFu/lHL5eD JW5CM5X5QtuHJn+e2PiZDppRNbbDxCR/v8RIHMC1+4QFNYc6Mi0gCdWLQw8xDIXAg2 6z/+hIiLnx2LNT4ooMuP1QPmcn+4ZNf8PDFp2CyGyWZpQ89a228YnIJ9zeBNaxij6P s0uROVGfDv5Kw== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id A5C814EEE5; Tue, 1 Dec 2026 17:18:23 +0000 (UTC) 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 X-In-Reply-To: <20261202-lapb-unlock-v3-v3-0-65b6ce65141b@qq.com> X-Cc: Hillf Danton <hdanton@sina.com>, "David S. Miller" <davem@davemloft.net>, Simon Horman <horms@kernel.org>, Xie He <xie.he.0141@gmail.com>, Andrew Lunn <andrew+netdev@lunn.ch>, Eric Dumazet <edumazet@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Willem de Bruijn <willemb@google.com>, syzbot+8328573e4d0514392471@syzkaller.appspotmail.com, linux-doc@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, linux-x25@vger.kernel.org, syzbot+059a2795ad4cff2a2695@syzkaller.appspotmail.com X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796145501; l=2021; i=SuperSkidder@qq.com; s=20261125; h=from:subject:message-id; bh=7XmQEfykwsqaZDHi9fsBVhsMV8OOY1zXSj3RY2ZcqQ0=; b=UydGWL3/w+EnMsA+7laXFEFnHA/SLORCXrxAFAIhT0nHPe4wnRCpKxHmpWNUmsIfrCWAXj9Nu iWN3U6SljpvCF+5u1YxnT4iUOAX+eXpHg8UJUI7X3hq4sgGT0C3KnMF X-Developer-Key: i=SuperSkidder@qq.com; a=ed25519; pk=HtDU+fHDhp/b7yb+opRFNaSEtNxybJRlJ2dM9BnxMwU= X-Endpoint-Received: by B4 Relay for SuperSkidder@qq.com/20261125 with auth_id=1634 X-Original-From: Yu Gao <SuperSkidder@qq.com> X-Reply-To: SuperSkidder@qq.com