aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2018-01-11 07:10:16 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-16 04:01:01 -0500
commitcbeef22fd611c4f47c494b821b2b105b8af970bb (patch)
tree0c8edc65bd4910472a946d0c32be0098f6bd8a0f
parentf0386c083c2ce85284dc0b419d7b89c8e567c09f (diff)
usb: uas: unconditionally bring back host after reset
Quoting Hans: If we return 1 from our post_reset handler, then our disconnect handler will be called immediately afterwards. Since pre_reset blocks all scsi requests our disconnect handler will then hang in the scsi_remove_host call. This is esp. bad because our disconnect handler hanging for ever also stops the USB subsys from enumerating any new USB devices, causes commands like lsusb to hang, etc. In practice this happens when unplugging some uas devices because the hub code may see the device as needing a warm-reset and calls usb_reset_device before seeing the disconnect. In this case uas_configure_endpoints fails with -ENODEV. We do not want to print an error for this, so this commit also silences the shost_printk for -ENODEV. ENDQUOTE However, if we do that we better drop any unconditional execution and report to the SCSI subsystem that we have undergone a reset but we are not operational now. Signed-off-by: Oliver Neukum <oneukum@suse.com> Reported-by: Hans de Goede <hdegoede@redhat.com> CC: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/storage/uas.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 5d04c40ee40a..3b1b9695177a 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -1076,20 +1076,19 @@ static int uas_post_reset(struct usb_interface *intf)
1076 return 0; 1076 return 0;
1077 1077
1078 err = uas_configure_endpoints(devinfo); 1078 err = uas_configure_endpoints(devinfo);
1079 if (err) { 1079 if (err && err != ENODEV)
1080 shost_printk(KERN_ERR, shost, 1080 shost_printk(KERN_ERR, shost,
1081 "%s: alloc streams error %d after reset", 1081 "%s: alloc streams error %d after reset",
1082 __func__, err); 1082 __func__, err);
1083 return 1;
1084 }
1085 1083
1084 /* we must unblock the host in every case lest we deadlock */
1086 spin_lock_irqsave(shost->host_lock, flags); 1085 spin_lock_irqsave(shost->host_lock, flags);
1087 scsi_report_bus_reset(shost, 0); 1086 scsi_report_bus_reset(shost, 0);
1088 spin_unlock_irqrestore(shost->host_lock, flags); 1087 spin_unlock_irqrestore(shost->host_lock, flags);
1089 1088
1090 scsi_unblock_requests(shost); 1089 scsi_unblock_requests(shost);
1091 1090
1092 return 0; 1091 return err ? 1 : 0;
1093} 1092}
1094 1093
1095static int uas_suspend(struct usb_interface *intf, pm_message_t message) 1094static int uas_suspend(struct usb_interface *intf, pm_message_t message)