diff options
| author | Matthew Dharm <mdharm-usb@one-eyed-alien.net> | 2002-07-15 03:19:17 -0700 |
|---|---|---|
| committer | Vojtech Pavlik <vojtech@suse.cz> | 2002-07-15 03:19:17 -0700 |
| commit | 6fa91667b6f5555c7ad5f065d72cb28e5ee9df4e (patch) | |
| tree | 75a30e043b2095c103590b656814cda81065ee90 | |
| parent | 793fb491657f2a4c82d96a92c3b539f3c131b3bf (diff) | |
[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.
| -rw-r--r-- | drivers/usb/storage/transport.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 9b22b2acb40c..8c3baaabfb02 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -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; } |
