Commit 6fa91667 authored by Matthew Dharm's avatar Matthew Dharm Committed by Vojtech Pavlik

[PATCH] usb-storage: catch bad commands

The purpose of this patch is to trap all commands which have a bogus
request_bufflen.  Much logic is devoted to calculating the proper length of
the transfer, but according to discussions I've had on linux-scsi, this is
really a bug in whatever is originating the bad command.

Hopefully, after people use this patch for a while, we'll eliminate all the
offending sources and can remove quite a bit of logic from the driver.
parent 793fb491
......@@ -344,6 +344,12 @@ unsigned int usb_stor_transfer_length(Scsi_Cmnd *srb)
len = srb->request_bufflen;
}
/* According to the linux-scsi people, any command sent which
* violates this invariant is a bug. In the hopes of removing
* all the complex logic above, let's find them and eliminate them.
*/
BUG_ON(len != srb->request_bufflen);
return len;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment