On Sun Nov 15, 2026 at 3:28 PM CET, Junjie Cao wrote:
> On Thu, Nov 12, 2026 at 06:49:03PM +0100, Tommaso Califano wrote:
>> +        if ((p->iov.size % p->ep->max_packet_size) || !p->iov.size ||
>
> max_packet_size is 0 until the guest sets a configuration
> (usb_ep_reset()), and dev-mtp handles bulk packets before that. From
> qtest, OpenSession, SendObjectInfo and SendObject without
> SET_CONFIGURATION write the file on master; with the series applied
> QEMU dies with SIGFPE on this line.
>

Thanks for pointing it out, I'll modify the guard in:
  !p->iov.size ||
  (p->ep->max_packet_size && (p->iov.size % p->ep->max_packet_size)

This should prevent the crash in that case.

>> +         *  - A Zero Length Packet
>
> usb_mtp_handle_data() stalls every OUT packet shorter than the
> container header before it gets here, so the !p->iov.size arm is not
> reached. With libmtp 1.1.20 in a Linux guest on xHCI or EHCI, a 500
> byte file (512 with the header) now lands intact, but mtp-sendfile
> still fails with "PTP I/O Error": the ZLP that ends the data phase
> (MTP 1.1, Appendix H) gets the "packet too small" STALL.
>

I'll add a new check before the stall response.

Thanks,
Tommaso


Reply via email to