Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vlatko Kosturjak" <kost@linux.hr>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usbip: vhci: do not give back URBs with an unchecked actual_length
Date: Thu, 05 Nov 2026 08:29:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-198723@kernel.org> (raw)
In-Reply-To: <auw5_lMRbGU97IKx@griffin.linux.hr>

> vhci_recv_ret_submit() copies actual_length from the RET_SUBMIT header
> into the URB, and only usbip_recv_xbuff() looks at it. That check is not
> enough:
> 
>  - an IN reply longer than transfer_buffer_length is rejected and the
>    connection shut down, but the URB is still given back with the
>    oversized actual_length (and status -EPROTO);
>  - a negative actual_length (urb->actual_length is a u32) is not
>    "> 0", so usbip_recv_xbuff() returns 0 without checking it and the
>    URB is given back with status 0;
>  - for OUT URBs usbip_recv_xbuff() returns 0 straight away, so any
>    actual_length is given back.
> 
> Completion handlers trust actual_length. usbfs copies that many bytes
> from the transfer buffer to user space in copy_urb_data_to_user(),
> [ ... ]
> (a short read), as the buffer was not filled.
> 
> Fixes: b348d7dddb6c ("USB: usbip: fix potential out-of-bounds write")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vlatko Kosturjak <kost@linux.hr>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/auw5_lMRbGU97IKx@griffin.linux.hr?part=1


      reply	other threads:[~2026-11-05  8:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  8:10 [PATCH v2] usbip: vhci: do not give back URBs with an unchecked actual_length Vlatko Kosturjak
2026-11-05  8:29 ` 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-198723@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kost@linux.hr \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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