uas: Add response iu handling
authorHans de Goede <hdegoede@redhat.com>
Sat, 13 Sep 2014 10:26:51 +0000 (12:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 04:42:12 +0000 (21:42 -0700)
If something goes wrong in our communication with an uas device we may get
a response iu in reaction to a cmnd, rather then a status iu. In this case
propagate an error upwards, rather then logging a bogus iu message.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/uas.c

index dfa11912708df4bfc376f4be31e956ff1a5e9151..b27fe21d866d2eb47563e7f9eb524fbd85fe16f2 100644 (file)
@@ -328,6 +328,16 @@ static void uas_stat_cmplt(struct urb *urb)
                }
                uas_xfer_data(urb, cmnd, SUBMIT_DATA_OUT_URB);
                break;
+       case IU_ID_RESPONSE:
+               uas_log_cmd_state(cmnd, "unexpected response iu",
+                                 ((struct response_iu *)iu)->response_code);
+               /* Error, cancel data transfers */
+               data_in_urb = usb_get_urb(cmdinfo->data_in_urb);
+               data_out_urb = usb_get_urb(cmdinfo->data_out_urb);
+               cmdinfo->state &= ~COMMAND_INFLIGHT;
+               cmnd->result = DID_ERROR << 16;
+               uas_try_complete(cmnd, __func__);
+               break;
        default:
                uas_log_cmd_state(cmnd, "bogus IU", iu->iu_id);
        }