[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 9/9] usb: mtp: reply INCOMPLETE_TRANSFER on read
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH 9/9] usb: mtp: reply INCOMPLETE_TRANSFER on read errors |
Date: |
Fri, 25 Apr 2014 14:12:13 +0200 |
Hi,
> The bogus data packet is sent with usb_packet_copy, shouldn't you return
> USB_RET_NAK for now?
I don't think so. The transfer must be completed, even if we don't send
valid data, because the guest expects a certain number of data bytes
before the result packet with the status code. If we don't send them we
are out of sync.
We might memset(d->data, 0, dlen) so the guest gets zeros instead of the
data block from the last successful read. The guest is supposed to
discard the data though, so it should not be needed.
Ahem, well, realloc doesn't clear memory, so I guess we better _do_
memset, so we don't leak random qemu memory to the guest in case the
very first read call fails. I'll fix it up.
cheers,
Gerd
- [Qemu-devel] [PATCH 0/9] usb: mtp: a bunch of fixes, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 2/9] usb: mtp: fix usb_mtp_add_u64, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 1/9] usb: mtp: replace debug printfs with trace points, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 7/9] usb: mtp: avoid empty description string, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 9/9] usb: mtp: reply INCOMPLETE_TRANSFER on read errors, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 5/9] usb: mtp: fix error path memory leak, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 8/9] usb: mtp: drop data-out hexdump, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 6/9] usb: mtp: fix possible buffer overflow, Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 3/9] usb: mtp: fix version (is decimal not bcd), Gerd Hoffmann, 2014/04/25
- [Qemu-devel] [PATCH 4/9] usb: mtp: fix serial (must be exact 32 chars), Gerd Hoffmann, 2014/04/25
- Re: [Qemu-devel] [PATCH 0/9] usb: mtp: a bunch of fixes, Peter Wu, 2014/04/25