Commit e4b60557 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] USB Storage: revert GetMaxLUN strictness

This is patch as384.  It reverts some of our sanity checks on the GetMaxLUN
part of the Bulk-only protocol.  Apparently, this is one area where vendors
can't even get close to correct.  So, in the face of any sort of error, we
assume a single LUN.

We also include some comments so we don't make this mistake again.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent f6b3ed42
......@@ -911,7 +911,6 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
int result;
/* issue the command */
us->iobuf[0] = 0;
result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
US_BULK_GET_MAX_LUN,
USB_DIR_IN | USB_TYPE_CLASS |
......@@ -922,7 +921,7 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
result, us->iobuf[0]);
/* if we have a successful request, return the result */
if (result >= 0)
if (result > 0)
return us->iobuf[0];
/*
......@@ -934,13 +933,16 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
if (result == -EPIPE) {
usb_stor_clear_halt(us, us->recv_bulk_pipe);
usb_stor_clear_halt(us, us->send_bulk_pipe);
/* return the default -- no LUNs */
return 0;
}
/* An answer or a STALL are the only valid responses. If we get
* something else, return an indication of error */
return -1;
/*
* Some devices don't like GetMaxLUN. They may STALL the control
* pipe, they may return a zero-length result, they may do nothing at
* all and timeout, or they may fail in even more bizarrely creative
* ways. In these cases the best approach is to use the default
* value: only one LUN.
*/
return 0;
}
int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
......
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