]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - usr.sbin/bhyve/pci_xhci.c
Prevent calling USB backends multiple times.
authorPeter Grehan <grehan@FreeBSD.org>
Fri, 26 Jun 2020 08:20:38 +0000 (08:20 +0000)
committerPeter Grehan <grehan@FreeBSD.org>
Fri, 26 Jun 2020 08:20:38 +0000 (08:20 +0000)
commit71ab6f970822d16f6f92a7168f4118bfb40a4dd3
tree457bc306ae52590816496b672fc7ee4bf05abcb6
parent1649caabbbb99c4f864119ac302f11e9c080a49e
Prevent calling USB backends multiple times.

The TRB processing loop could potentially call a back-end twice
with the same status transaction. While this was generally benign,
some code paths in the tablet backend weren't set up to handle
this case, resulting in a NULL dereference.

Fix by
 - returning a STALL error when an invalid request was seen in the backend
 - skipping a call to the backend if the number of packets in a status
   transaction was zero (this code fragment was taken from the Intel ACRN
   xhci backend)

PR: 246964
Reported by:  Ali Abdallah
Discussed with: Leon Dang (author)
Reviewed by: jhb (#bhyve), Leon Dang
Approved by: jhb
Obtained from:  Intel ACRN (partially)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25228
usr.sbin/bhyve/pci_xhci.c
usr.sbin/bhyve/usb_mouse.c