All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 5/5] ehci: fix queue->dev null ptr dereference
Date: Thu, 22 Aug 2019 08:52:42 +0200	[thread overview]
Message-ID: <20190822065242.12496-6-kraxel@redhat.com> (raw)
In-Reply-To: <20190822065242.12496-1-kraxel@redhat.com>

In case we don't have a device for an active queue, just skip
processing the queue (same we do for inactive queues) and log
a guest bug.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20190821085319.13711-1-kraxel@redhat.com
---
 hw/usb/hcd-ehci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 9ca7b87a8001..56ab2f457f4c 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1838,6 +1838,9 @@ static int ehci_state_fetchqtd(EHCIQueue *q)
             ehci_set_state(q->ehci, q->async, EST_EXECUTING);
             break;
         }
+    } else if (q->dev == NULL) {
+        ehci_trace_guest_bug(q->ehci, "no device attached to queue");
+        ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH);
     } else {
         p = ehci_alloc_packet(q);
         p->qtdaddr = q->qtdaddr;
-- 
2.18.1



  parent reply	other threads:[~2019-08-22  6:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  6:52 [Qemu-devel] [PULL 0/5] Usb 20190822 patches Gerd Hoffmann
2019-08-22  6:52 ` [Qemu-devel] [PULL 1/5] usbredir: fix buffer-overflow on vmload Gerd Hoffmann
2019-08-22  6:52 ` [Qemu-devel] [PULL 2/5] usb-redir: merge interrupt packets Gerd Hoffmann
2019-08-22  6:52 ` [Qemu-devel] [PULL 3/5] xhci: Add No Op Command Gerd Hoffmann
2019-08-22  6:52 ` [Qemu-devel] [PULL 4/5] usb: reword -usb command-line option and mention xHCI Gerd Hoffmann
2019-08-22  6:52 ` Gerd Hoffmann [this message]
2019-08-22 15:13 ` [Qemu-devel] [PULL 0/5] Usb 20190822 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=20190822065242.12496-6-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --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 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.