summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-11-15 10:04:11 +0100
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-03-05 00:38:26 +0100
commit8e453155d7f8dfa53863ba6f8da6c68f7c17ece4 (patch)
tree00c7fc346e599aa3efca73583aa1dcaf9e04f2c7
parentuas: Improve error reporting (diff)
downloadlinux-8e453155d7f8dfa53863ba6f8da6c68f7c17ece4.tar.xz
linux-8e453155d7f8dfa53863ba6f8da6c68f7c17ece4.zip
uas: Add some data in/out ready iu sanity checks
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
-rw-r--r--drivers/usb/storage/uas.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index f09205b162e4..62086829af14 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -379,9 +379,19 @@ static void uas_stat_cmplt(struct urb *urb)
uas_try_complete(cmnd, __func__);
break;
case IU_ID_READ_READY:
+ if (!cmdinfo->data_in_urb ||
+ (cmdinfo->state & DATA_IN_URB_INFLIGHT)) {
+ scmd_printk(KERN_ERR, cmnd, "unexpected read rdy\n");
+ break;
+ }
uas_xfer_data(urb, cmnd, SUBMIT_DATA_IN_URB);
break;
case IU_ID_WRITE_READY:
+ if (!cmdinfo->data_out_urb ||
+ (cmdinfo->state & DATA_OUT_URB_INFLIGHT)) {
+ scmd_printk(KERN_ERR, cmnd, "unexpected write rdy\n");
+ break;
+ }
uas_xfer_data(urb, cmnd, SUBMIT_DATA_OUT_URB);
break;
default: