]> git.proxmox.com Git - qemu.git/commitdiff
usb-ehci: Ensure frindex writes leave a valid frindex value
authorHans de Goede <hdegoede@redhat.com>
Tue, 3 Apr 2012 12:21:47 +0000 (14:21 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 26 Apr 2012 10:21:15 +0000 (12:21 +0200)
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>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-ehci.c

index c6f21ac7b6d92267b568d38437d41eccfe2fadd4..4ff4d40a8c2629a00ff0d20574cfedb19339ae5d 100644 (file)
@@ -1101,6 +1101,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) {