Ensure the bmRequestType is the right type for the incoming control request.

Submitted by:	Hans Petter Selasky
This commit is contained in:
Andrew Thompson 2009-05-13 18:26:55 +00:00
parent 8ea86e467f
commit 7261357fbc

View File

@ -466,7 +466,8 @@ ustorage_fs_handle_request(device_t dev,
const struct usb2_device_request *req = preq;
if (!is_complete) {
if (req->bRequest == UR_BBB_RESET) {
if ((req->bmRequestType == UT_WRITE_CLASS_INTERFACE) &&
(req->bRequest == UR_BBB_RESET)) {
*plen = 0;
mtx_lock(&sc->sc_mtx);
ustorage_fs_transfer_stop(sc);
@ -475,7 +476,8 @@ ustorage_fs_handle_request(device_t dev,
USTORAGE_FS_T_BBB_COMMAND);
mtx_unlock(&sc->sc_mtx);
return (0);
} else if (req->bRequest == UR_BBB_GET_MAX_LUN) {
} else if ((req->bmRequestType == UT_READ_CLASS_INTERFACE) &&
(req->bRequest == UR_BBB_GET_MAX_LUN)) {
if (offset == 0) {
*plen = 1;
*pptr = &sc->sc_last_lun;