usb: add pid check at the first of uhci_handle_td()
commit5f77e06baa84323e5bbc96c2c7f4fe627078b210
authorGonglei <arei.gonglei@huawei.com>
Fri, 19 Feb 2016 07:33:58 +0000 (19 15:33 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 23 Feb 2016 09:38:01 +0000 (23 10:38 +0100)
tree14988e1e4f582f689658be931b4bc48f4bb69b81
parentfe3c546c5ff2a6210f9a4d8561cc64051ca8603e
usb: add pid check at the first of uhci_handle_td()

pid can be gotten from uhci device memory in uhci_handle_td(),
so the guest can trigger assert qemu if we get an invalid pid.
And the uhci spec 2.1.2 tells us The Host Controller sets Host
Controller Process Error bit to 1 when it detects a fatal error
and indicates that the Host Controller suffered a consistency
check failure while processing a Transfer Descriptor. An example
of a consistency check failure would be finding an illegal PID
field while processing the packet header portion of the TD.
When this error occurs, the Host Controller clears the Run/Stop
bit in the Command register to prevent further schedule execution.

We'd better to set UHCI_STS_HCPERR and kick an interrupt, check
the pid value at the first of uhci_handle_td function.

https://bugzilla.redhat.com/show_bug.cgi?id=1070027

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-id: 1455867238-4720-1-git-send-email-arei.gonglei@huawei.com

[ applied minor codestyle fix ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-uhci.c