Skip to contentSkip to conversation

(resend)[PATCH 2/2] ps2: Fix mouse stream corruption due to lost data

Qemu-devel Geoffrey McRae 1 participant 1 message May 7, 2018

lore
Share & tools
lore
#0 lore raw

This fixes an issue by adding bounds checking to multi-byte packets where the PS/2 mouse data stream may become corrupted due to data being discarded when the PS/2 ringbuffer is full.

Interrupts for Multi-byte responses are postponed until the final byte has been queued.

These changes fix a bug where windows guests drop the mouse device entirely requring the guest to be restarted.

---
 hw/input/pckbd.c |   6 +--
 hw/input/ps2.c   | 160 +++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 110 insertions(+), 56 deletions(-)
hw/input/pckbd.c +2 -2
index f17f18e51b..004ea3466d 100644
@@ -216,9 +216,9 @@ static uint64_t kbd_read_status(void *opaque, hwaddr addr,
 static void kbd_queue(KBDState *s, int b, int aux)
 {
     if (aux)
-        ps2_queue(s->mouse, b);
+        ps2_queue_raise(s->mouse, b);
     else
-        ps2_queue(s->kbd, b);
+        ps2_queue_raise(s->kbd, b);
 }
 
 static void outport_write(KBDState *s, uint32_t val)
hw/input/ps2.c +106 -52

322 lines not on this page · raw message

Signature · 1 line
2.14.2