Page MenuHomeFreeBSD

bhyve: fix USB mouse requests
AcceptedPublic

Authored by chuck on Sun, Jan 11, 11:15 PM.

Details

Reviewers
imp
jhb
markj
corvink
Group Reviewers
bhyve
Summary

USB HCI requests may not include HCI transfer block structures (i.e.,
xfer->data[] == NULL), but in several places, the USB mouse emulation
code assumes one will exist. This can lead to a NULL pointer dereference
and a SEGV in the bhyve process as observed via experiments with an
Ubuntu guest and PyUSB code. Note that many of the cases processing
other request types already checked for data == NULL.

While in the neighborhood, fix a typo in the loop iterating over the
usb_data_xfer_block array which used the wrong variable to check for
valid data (idx vs. i).

Reported by: danmcd@edgecast.io
Obtained from: SmartOS
MFC after: 1 week
Relnotes: yes

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69812
Build 66695: arc lint + arc unit

Event Timeline

Note this fixes the issue reported in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282237 and with commit 7631790422464de1aec309018e2c444defe5f629 differently, but the fix mirrors what SmartOS/illumos did to minimize diff's between the various bhyve implementations.

This works for me too. Feel free to revert the thing I committed.
I gotta work on tagging people better on github reviews

This revision is now accepted and ready to land.Mon, Jan 12, 12:44 AM
emaste added inline comments.
usr.sbin/bhyve/usb_mouse.c
346