All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luigi Leonardi <leonardi@redhat.com>
To: Tommaso Califano <tcalifano@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org,
	"Junjie Cao" <junjie.cao@intel.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Abizer Lokhandwala" <abizerlokhandwalastd10@gmail.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH] hw/usb/dev-mtp: Fix assert crash on undersized BULK IN
Date: Tue, 13 Oct 2026 10:19:01 +0200	[thread overview]
Message-ID: <as3otb2jmb6SVTUw@leonardi-redhat> (raw)
In-Reply-To: <20261012140839.93559-1-tcalifano@redhat.com>

On Mon, Oct 12, 2026 at 04:08:38PM +0200, Tommaso Califano wrote:
>The EP_DATA_IN result path serializes the queued response as a 12
>byte MTP container header followed by one 4 byte word per result
>argument (12 + 4 * argc bytes).  The entry check at the top of the
>function only verifies that the guest-provided transfer buffer holds
>at least the 12 byte header.
>
>If the queued result carries arguments, e.g. RES_SESSION_ALREADY_OPEN
>which returns the existing session ID, the second usb_packet_copy()
>writes past the end of the guest-declared buffer and trips the
>p->actual_length + bytes <= iov->size assertion, aborting QEMU.  A
>guest can control the transfer size freely, e.g. TBYTES in the qTD
>of an EHCI BULK IN.
>
>A device must not send more data than the initiator signaled it would
>accept. Stall the transfer instead, and keep the result queued so that
>a subsequent BULK IN with a sufficient buffer size delivers the full
>response.
>
>Fixes: 840a178c94db ("usb: mtp filesharing")
>Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3386
>Signed-off-by: Tommaso Califano <tcalifano@redhat.com>
>---

code LGTM!

Reviewed-by: Luigi Leonardi <leonardi@redhat.com>

Thanks,
Luigi



  reply	other threads:[~2026-10-13  8:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 14:08 [PATCH] hw/usb/dev-mtp: Fix assert crash on undersized BULK IN Tommaso Califano
2026-10-13  8:19 ` Luigi Leonardi [this message]
2026-10-13 15:04 ` Junjie Cao

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=as3otb2jmb6SVTUw@leonardi-redhat \
    --to=leonardi@redhat.com \
    --cc=abizerlokhandwalastd10@gmail.com \
    --cc=junjie.cao@intel.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=tcalifano@redhat.com \
    --cc=thuth@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.