From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E46131F00A07; Sat, 5 Dec 2026 17:39:14 +0000 (UTC) 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== Subject: Re: [PATCH net v3 2/3] net: lapbether: bound the receive queue From: netdev-bot+sashiko@kernel.org To: SuperSkidder@qq.com 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 Date: Sat, 05 Dec 2026 17:39:14 +0000 Message-ID: <179649235448.3146.5216638636094775268@kernel.org> In-Reply-To: <20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com> References: <20261202-lapb-unlock-v3-v3-2-65b6ce65141b@qq.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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