From: Jason Winter <jjx@live.nl>
To: netdev@vger.kernel.org
Cc: linux-usb@vger.kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux@rainbow-software.org,
gregkh@linuxfoundation.org, Jason Winter <jjx@live.nl>
Subject: [PATCH net] net: usb: cx82310_eth: bound partial-frame remainder by current skb length
Date: Fri, 14 Aug 2026 21:08:14 +0200 [thread overview]
Message-ID: <BESP194MB28324DC870B7DE2E694CCEEEB8DA2@BESP194MB2832.EURP194.PROD.OUTLOOK.COM> (raw)
When a frame straddles two bulk URBs, cx82310_rx_fixup() stores the
number of bytes still expected in dev->partial_rem and on the next call
memcpy()s that many bytes from the new skb without checking that the new
URB actually delivered that much data. A malicious device can declare a
large frame in one URB and follow it with a short URB, causing the
memcpy to read past the valid skb data into uncleared bytes in the
receive buffer and forward the result up the network stack.
Drop the partial frame and reset the carry-over state if the current skb
is shorter than the recorded remainder.
Fixes: cc28a20e77b2 ("introduce cx82310_eth: Conexant CX82310-based ADSL router USB ethernet driver")
Assisted-by: gkh_clanker_t1000
Signed-off-by: Jason Winter <jjx@live.nl>
---
drivers/net/usb/cx82310_eth.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c
index 068acb052adb..8ca6b75fdd20 100644
--- a/drivers/net/usb/cx82310_eth.c
+++ b/drivers/net/usb/cx82310_eth.c
@@ -251,6 +251,13 @@ static int cx82310_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
* end of that packet at the beginning.
*/
if (dev->partial_rem) {
+ if (dev->partial_rem > skb->len) {
+ netdev_err(dev->net,
+ "RX partial frame: need %lu, got %u\n",
+ dev->partial_rem, skb->len);
+ dev->partial_rem = 0;
+ return 0;
+ }
len = dev->partial_len + dev->partial_rem;
skb2 = alloc_skb(len, GFP_ATOMIC);
if (!skb2)
--
2.55.0
next reply other threads:[~2026-08-14 19:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 19:08 Jason Winter [this message]
2026-08-14 20:11 ` [PATCH net] net: usb: cx82310_eth: bound partial-frame remainder by current skb length Andrew Lunn
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=BESP194MB28324DC870B7DE2E694CCEEEB8DA2@BESP194MB2832.EURP194.PROD.OUTLOOK.COM \
--to=jjx@live.nl \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@rainbow-software.org \
--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;
as well as URLs for NNTP newsgroup(s).