svn commit: r192057 - head/sys/dev/usb/storage

Andrew Thompson thompsa at FreeBSD.org
Wed May 13 18:26:56 UTC 2009


Author: thompsa
Date: Wed May 13 18:26:55 2009
New Revision: 192057
URL: http://svn.freebsd.org/changeset/base/192057

Log:
  Ensure the bmRequestType is the right type for the incoming control request.
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/usb/storage/ustorage_fs.c

Modified: head/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- head/sys/dev/usb/storage/ustorage_fs.c	Wed May 13 18:25:14 2009	(r192056)
+++ head/sys/dev/usb/storage/ustorage_fs.c	Wed May 13 18:26:55 2009	(r192057)
@@ -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;


More information about the svn-src-head mailing list