summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-05-13 18:26:55 +0000
committerthompsa <thompsa@FreeBSD.org>2009-05-13 18:26:55 +0000
commit94d6c89e53c1d0067e10f923a74b508fe4370bb2 (patch)
tree27c18d8251f7f7ffafb1934cbb0c0d36861d7f76
parent27ca001bb56c5e94539f95d5e2434f63c75ec702 (diff)
downloadFreeBSD-src-94d6c89e53c1d0067e10f923a74b508fe4370bb2.zip
FreeBSD-src-94d6c89e53c1d0067e10f923a74b508fe4370bb2.tar.gz
Ensure the bmRequestType is the right type for the incoming control request.
Submitted by: Hans Petter Selasky
-rw-r--r--sys/dev/usb/storage/ustorage_fs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/storage/ustorage_fs.c b/sys/dev/usb/storage/ustorage_fs.c
index c810c2e..8e8a509 100644
--- a/sys/dev/usb/storage/ustorage_fs.c
+++ b/sys/dev/usb/storage/ustorage_fs.c
@@ -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;
OpenPOWER on IntegriCloud