From: Bandan Das <bsd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] usb-mtp: Assert on suspicious TYPE_DATA packet from initiator
Date: Fri, 18 May 2018 14:38:45 -0400 [thread overview]
Message-ID: <jpg1se87qru.fsf@linux.bootlegged.copy> (raw)
In-Reply-To: <CAFEAcA_QOHPbhmEAqaDvSVgBiktBkh06uA623bNzgK16msBAXQ@mail.gmail.com> (Peter Maydell's message of "Fri, 18 May 2018 19:25:37 +0100")
Peter Maydell <peter.maydell@linaro.org> writes:
> On 18 May 2018 at 19:22, Bandan Das <bsd@redhat.com> wrote:
>>
>> CID 1390604
>> If the initiator sends a packet with TYPE_DATA set without
>> initiating a CMD_GET_OBJECT_INFO first, then usb_mtp_get_data
>> can trip on a null s->data_out.
>>
>> Signed-off-by: Bandan Das <bsd@redhat.com>
>
> I think you said this can be provoked by the guest?
Yes, this can only be initated by the guest as far as I
understand.
> Misbehaving or malicious guests should never be able
> to provoke assertions.
I am not sure, I thought it's better to kill a misbehaving guest rather
than silently letting it run. Anyway, it's possible to send a
No_Valid_ObjectInfo as well and we wouldn't have to mark it as a
false positive either.
Bandan
>> ---
>> hw/usb/dev-mtp.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
>> index 3d59fe4944..905e025d7f 100644
>> --- a/hw/usb/dev-mtp.c
>> +++ b/hw/usb/dev-mtp.c
>> @@ -1696,6 +1696,7 @@ static void usb_mtp_get_data(MTPState *s, mtp_container *container,
>> uint64_t dlen;
>> uint32_t data_len = p->iov.size;
>>
>> + assert(d != NULL);
>> if (d->first) {
>> /* Total length of incoming data */
>> d->length = cpu_to_le32(container->length) - sizeof(mtp_container);
>> --
>> 2.14.3
>
> thanks
> -- PMM
next prev parent reply other threads:[~2018-05-18 18:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 9:44 [Qemu-devel] [PULL 0/3] Usb 20180507 patches Gerd Hoffmann
2018-05-07 9:44 ` [Qemu-devel] [PULL 1/3] usb-mtp: Add some NULL checks for issues pointed out by coverity Gerd Hoffmann
2018-05-15 18:50 ` Peter Maydell
2018-05-17 21:41 ` Bandan Das
2018-05-18 18:22 ` [Qemu-devel] [PATCH] usb-mtp: Assert on suspicious TYPE_DATA packet from initiator Bandan Das
2018-05-18 18:25 ` Peter Maydell
2018-05-18 18:38 ` Bandan Das [this message]
2018-05-18 18:49 ` Peter Maydell
2018-05-18 19:04 ` Bandan Das
2018-05-18 18:49 ` [Qemu-devel] [PATCH v2] usb-mtp: Return error " Bandan Das
2018-05-18 18:25 ` [Qemu-devel] [PULL 1/3] usb-mtp: Add some NULL checks for issues pointed out by coverity Bandan Das
2018-05-07 9:44 ` [Qemu-devel] [PULL 2/3] usb-mtp: Unconditionally check for the readonly bit Gerd Hoffmann
2018-05-07 9:44 ` [Qemu-devel] [PULL 3/3] usb-host: skip open on pending postload bh Gerd Hoffmann
2018-05-08 13:22 ` [Qemu-devel] [PULL 0/3] Usb 20180507 patches Peter Maydell
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=jpg1se87qru.fsf@linux.bootlegged.copy \
--to=bsd@redhat.com \
--cc=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).