From: sashiko-bot@kernel.org
To: "Cheng Yongkang" <teel4res@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usb: usbfs: clamp actual_length to transfer_buffer_length
Date: Sun, 01 Nov 2026 07:21:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-192302@kernel.org> (raw)
In-Reply-To: <20261101070651.1846947-1-teel4res@gmail.com>
> usbfs uses urb->actual_length from the host controller driver without
> checking it against the buffer it allocated. For a completed
> non-isochronous IN URB, processcompl() and processcompl_compat() copy
> that many bytes to userspace and report the same value, and
> async_completed() passes it to snoop_urb_data() when usbfs_snoop is
> enabled.
>
> With USB/IP, the value comes from the remote peer. If the peer returns
> actual_length=88 for a 24-byte control-IN transfer, usbip_recv_xbuff()
> rejects the length, but VHCI still gives back the URB with -EPROTO and
> actual_length=88. usbfs copies data from failed URBs too, since they
> can carry valid partial data, so reaping the URB reads past the buffer:
>
> BUG: KASAN: slab-out-of-bounds in _copy_to_user
> copy_urb_data_to_user
> [ ... ]
>
> Fixes: 0880aef49e40a ("USB: usbfs_snoop: add data logging back in")
> Fixes: d4a4683ca054e ("USB: usbfs: only copy the actual data received")
> Cc: stable@vger.kernel.org
> Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261101070651.1846947-1-teel4res@gmail.com?part=1
prev parent reply other threads:[~2026-11-01 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 7:06 [PATCH v2] usb: usbfs: clamp actual_length to transfer_buffer_length Cheng Yongkang
2026-11-01 7:21 ` sashiko-bot [this message]
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=sashiko-outbox-192302@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=teel4res@gmail.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