task management commands expect a response_iu rather then a sense_iu, and
these have different sizes. Make the urb we submit to get the reply the right
size.
Signed-off-by: Hans de Goede hdego...@redhat.com
---
drivers/usb/storage/uas.c | 19 ---
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 33f9dcd..83c2ef8 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -429,7 +429,8 @@ static struct urb *uas_alloc_data_urb(struct uas_dev_info
*devinfo, gfp_t gfp,
return urb;
}
-static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp,
+static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo,
+ int size, gfp_t gfp,
struct Scsi_Host *shost, u16 stream_id)
{
struct usb_device *udev = devinfo-udev;
@@ -439,11 +440,11 @@ static struct urb *uas_alloc_sense_urb(struct
uas_dev_info *devinfo, gfp_t gfp,
if (!urb)
goto out;
- iu = kzalloc(sizeof(*iu), gfp);
+ iu = kzalloc(size, gfp);
if (!iu)
goto free;
- usb_fill_bulk_urb(urb, udev, devinfo-status_pipe, iu, sizeof(*iu),
+ usb_fill_bulk_urb(urb, udev, devinfo-status_pipe, iu, size,
uas_stat_cmplt, shost);
urb-stream_id = stream_id;
urb-transfer_flags |= URB_FREE_BUFFER;
@@ -548,13 +549,13 @@ err:
* daft to me.
*/
-static int uas_submit_sense_urb(struct Scsi_Host *shost,
+static int uas_submit_sense_urb(struct Scsi_Host *shost, int size,
gfp_t gfp, unsigned int stream)
{
struct uas_dev_info *devinfo = (void *)shost-hostdata[0];
struct urb *urb;
- urb = uas_alloc_sense_urb(devinfo, gfp, shost, stream);
+ urb = uas_alloc_sense_urb(devinfo, size, gfp, shost, stream);
if (!urb)
return SCSI_MLQUEUE_DEVICE_BUSY;
usb_anchor_urb(urb, devinfo-sense_urbs);
@@ -576,7 +577,8 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
WARN_ON_ONCE(!spin_is_locked(devinfo-lock));
if (cmdinfo-state SUBMIT_STATUS_URB) {
- err = uas_submit_sense_urb(cmnd-device-host, gfp,
+ err = uas_submit_sense_urb(cmnd-device-host,
+ sizeof(struct sense_iu), gfp,
cmdinfo-stream);
if (err) {
return err;
@@ -724,10 +726,13 @@ static int uas_eh_task_mgmt(struct scsi_cmnd *cmnd,
struct uas_dev_info *devinfo = (void *)shost-hostdata[0];
u16 tag = devinfo-qdepth - 1;
unsigned long flags;
+ int r;
spin_lock_irqsave(devinfo-lock, flags);
memset(devinfo-response, 0, sizeof(devinfo-response));
- if (uas_submit_sense_urb(shost, GFP_ATOMIC, tag)) {
+ r = uas_submit_sense_urb(shost, sizeof(struct response_iu),
+GFP_ATOMIC, tag);
+ if (r != 0) {
shost_printk(KERN_INFO, shost,
%s: %s: submit sense urb failed\n,
__func__, fname);
--
1.8.4.2
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html