qemu/0047-usb-ehci-Ensure-frindex-writes-leave-a-valid-frindex.patch
Cole Robinson 1ffd2723e8 Fix -vga vmware crashes (bz #836260)
Fix vhost crash (bz #918272)
Fix kvm module permissions after first install (bz #907215)
2013-04-02 12:35:23 -04:00

33 lines
1.2 KiB
Diff

From ede6c50c5236dd0cdbcef242320ad3c8bc2bbfd3 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 3 Apr 2012 14:04:31 +0200
Subject: [PATCH] usb-ehci: Ensure frindex writes leave a valid frindex value
frindex is a 14 bits counter, so bits 31-14 should always be 0, and
after the commit titled "usb-ehci: frindex always is a 14 bits counter"
we rely on frindex always being a multiple of 8. I've not seen this in
practice, but theoretically a guest can write a value >= 0x4000 or a value
which is not a multiple of 8 value to frindex, this patch ensures that
things will still work when that happens.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/usb-ehci.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index ff69587..16e6053 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1081,6 +1081,10 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val)
val &= USBINTR_MASK;
break;
+ case FRINDEX:
+ val &= 0x00003ff8; /* frindex is 14bits and always a multiple of 8 */
+ break;
+
case CONFIGFLAG:
val &= 0x1;
if (val) {