From: Simon Horman <horms@kernel.org>
To: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
Cc: Petko Manolov <petkan@nucleusys.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Wei Jie Law <98lawweijie@gmail.com>,
stable@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] net: usb: pegasus: do not advance rx_skb->data on dropped frames
Date: Mon, 26 Oct 2026 16:31:33 +0000 [thread overview]
Message-ID: <20261026163133.GB257209@horms.kernel.org> (raw)
In-Reply-To: <20261021020310.34045-2-law.wei.jie@gt.tech.gov.sg>
On Wed, Oct 21, 2026 at 10:03:09AM +0800, Wei Jie Law wrote:
> For the 0x8513 chip, read_bulk_callback() skips the 2-byte receive
> header by advancing pegasus->rx_skb->data in place. This is done before
> the pkt_len > PEGASUS_MTU check, and when that check drops the frame
> the goon path resubmits the same skb with the advanced rx_skb->data as
> the transfer buffer, still PEGASUS_MTU bytes long.
>
> Every frame with an oversized length field therefore moves the receive
> buffer two more bytes towards the end of the skb data area. A device
> that keeps sending such frames makes the host controller write received
> data over skb_shared_info and past the end of the allocation, and the
> corrupted skb_shared_info is used when the skb is eventually freed.
> With an emulated device sending frames filled with 0x5a on a KASAN
> kernel:
>
> BUG: KASAN: slab-out-of-bounds in dummy_timer+0xade/0x3f00 [dummy_hcd]
> Write of size 1536 at addr ffff888105821202 by task swapper/1/0
> ...
> Oops: general protection fault, probably for non-canonical address 0xeb4b474b4b4b4b4c: 0000 [#1] PREEMPT SMP KASAN NOPTI
> KASAN: maybe wild-memory-access in range [0x5a5a5a5a5a5a5a60-0x5a5a5a5a5a5a5a67]
> RIP: 0010:skb_release_data+0x36f/0x800
>
> Only skip the header with skb_reserve() once the frame is going to be
> passed up, so the receive buffer always starts at the beginning of the
> skb data area. Unlike the old pointer adjustment, skb_reserve() also
> moves skb->tail, so the two header bytes now count against the buffer
> size: lower the length limit for the 0x8513 accordingly, otherwise a
> pkt_len of PEGASUS_MTU - 1 or PEGASUS_MTU would trip skb_over_panic().
>
> Found by code review with LLM assistance and reproduced with an
> emulated USB device (raw-gadget + dummy_hcd).
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-10-26 16:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 2:03 [PATCH net v2 0/2] net: usb: pegasus: fix receive length handling Wei Jie Law
2026-10-21 2:03 ` [PATCH net v2 1/2] net: usb: pegasus: do not advance rx_skb->data on dropped frames Wei Jie Law
2026-10-26 16:31 ` Simon Horman [this message]
2026-10-21 2:03 ` [PATCH net v2 2/2] net: usb: pegasus: check rx pkt_len against the received length Wei Jie Law
2026-10-26 16:31 ` Simon Horman
2026-10-26 23:20 ` [PATCH net v2 0/2] net: usb: pegasus: fix receive length handling patchwork-bot+netdevbpf
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=20261026163133.GB257209@horms.kernel.org \
--to=horms@kernel.org \
--cc=98lawweijie@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=law.wei.jie@gt.tech.gov.sg \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petkan@nucleusys.com \
--cc=stable@vger.kernel.org \
/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®