From: Hui Peng <benquike@gmail.com>
To: ms@dev.tdt.de, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: linux-x25@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] net: wan: lapbether: validate frame length and headroom in lapbeth_rcv() and xmit
Date: Sat, 19 Sep 2026 22:34:33 +0000 [thread overview]
Message-ID: <20260919223433.3882618-1-benquike@gmail.com> (raw)
In drivers/net/wan/lapbether.c, call pskb_may_pull() before reading the
2-byte length prefix in lapbeth_rcv() and ensure sufficient headroom in
lapbeth_data_transmit().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index c3630a82913b..3838910ea7bd 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -133,11 +133,13 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev,
goto drop_unlock;
len = skb->data[0] + skb->data[1] * 256;
- dev->stats.rx_packets++;
- dev->stats.rx_bytes += len;
skb_pull(skb, 2); /* Remove the length bytes */
- skb_trim(skb, len); /* Set the length of the data */
+ if (pskb_trim_rcsum(skb, len))
+ goto drop_unlock;
+
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += len;
err = lapb_data_received(lapbeth->axdev, skb);
if (err != LAPB_OK) {
next reply other threads:[~2026-09-19 22:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 22:34 Hui Peng [this message]
2026-09-20 22:34 ` netdev-bot+sashiko
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=20260919223433.3882618-1-benquike@gmail.com \
--to=benquike@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-x25@vger.kernel.org \
--cc=ms@dev.tdt.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®