qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-1.6 0/2] usb fixes
@ 2013-08-01 13:11 Gerd Hoffmann
  2013-08-01 13:11 ` [Qemu-devel] [PATCH 1/2] xhci: fix segfault Gerd Hoffmann
  2013-08-01 13:11 ` [Qemu-devel] [PATCH 2/2] usb-redir: fix use-after-free Gerd Hoffmann
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2013-08-01 13:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Two more little usb fixes for 1.6.

please pull,
  Gerd

The following changes since commit 75e2a4baf1536682d111d9bee0261806737a32dc:

  Merge remote-tracking branch 'spice/spice.v72' into staging (2013-07-30 18:48:58 -0500)

are available in the git repository at:


  git://git.kraxel.org/qemu usb.86

for you to fetch changes up to a14ff8a650b5943ee6221b952494661f7cb3b5e2:

  usb-redir: fix use-after-free (2013-08-01 13:03:42 +0200)

----------------------------------------------------------------
Gerd Hoffmann (2):
      xhci: fix segfault
      usb-redir: fix use-after-free

 hw/usb/hcd-xhci.c |    5 ++---
 hw/usb/redirect.c |    1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 1/2] xhci: fix segfault
  2013-08-01 13:11 [Qemu-devel] [PULL for-1.6 0/2] usb fixes Gerd Hoffmann
@ 2013-08-01 13:11 ` Gerd Hoffmann
  2013-08-01 13:11 ` [Qemu-devel] [PATCH 2/2] usb-redir: fix use-after-free Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2013-08-01 13:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, qemu-stable

Guest trying to reset a endpoint of a disconnected device resulted in
xhci trying to dereference uport while being NULL, thereby crashing
qemu.  Fix that by adding a check.  Drop unused dev variable while
touching that code bit.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-xhci.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 7cbf813..ff5f681 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1429,7 +1429,6 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid,
 {
     XHCISlot *slot;
     XHCIEPContext *epctx;
-    USBDevice *dev;
 
     trace_usb_xhci_ep_reset(slotid, epid);
     assert(slotid >= 1 && slotid <= xhci->numslots);
@@ -1465,8 +1464,8 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid,
         ep |= 0x80;
     }
 
-    dev = xhci->slots[slotid-1].uport->dev;
-    if (!dev) {
+    if (!xhci->slots[slotid-1].uport ||
+        !xhci->slots[slotid-1].uport->dev) {
         return CC_USB_TRANSACTION_ERROR;
     }
 
-- 
1.7.9.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 2/2] usb-redir: fix use-after-free
  2013-08-01 13:11 [Qemu-devel] [PULL for-1.6 0/2] usb fixes Gerd Hoffmann
  2013-08-01 13:11 ` [Qemu-devel] [PATCH 1/2] xhci: fix segfault Gerd Hoffmann
@ 2013-08-01 13:11 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2013-08-01 13:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Reinitialize dev->cs to NULL after deleting it, to make sure it isn't
used afterwards.

Reported-by: Martin Cerveny <M.Cerveny@computer.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/redirect.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 8b8c010..e3b9f32 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1334,6 +1334,7 @@ static void usbredir_handle_destroy(USBDevice *udev)
     USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
 
     qemu_chr_delete(dev->cs);
+    dev->cs = NULL;
     /* Note must be done after qemu_chr_close, as that causes a close event */
     qemu_bh_delete(dev->chardev_close_bh);
 
-- 
1.7.9.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-02  2:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01 13:11 [Qemu-devel] [PULL for-1.6 0/2] usb fixes Gerd Hoffmann
2013-08-01 13:11 ` [Qemu-devel] [PATCH 1/2] xhci: fix segfault Gerd Hoffmann
2013-08-01 13:11 ` [Qemu-devel] [PATCH 2/2] usb-redir: fix use-after-free Gerd Hoffmann

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).