Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2330246imm; Thu, 7 Jun 2018 08:54:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLWP+M1jtBamOw8KE1ubNZuXVyqgYjtUwJxvYAXo4MLh9B2JZcbKxs/zXXmHTxzX8v/xY+W X-Received: by 2002:a63:62c7:: with SMTP id w190-v6mr2113286pgb.104.1528386858131; Thu, 07 Jun 2018 08:54:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528386858; cv=none; d=google.com; s=arc-20160816; b=KobyYY32Q4AAJBIiAEdco+dm9J/zZtlNLQjSeHyD6RRvWq3YzWXGm7kW9YvlOYCOjj FgYS9CUhRH6t1LyxrejVPfK0XCTnGoA/kvQqYCSKhXfcWH5GC9/KTcSVMPUMy30aUY3O 62Ci3iu2d+umO8IiYS7H2DVnckg9ft/HMxrGnNzJhMLkovL8ijtMAlzsLGIQLbkNvAOn 01TVT7eebNervTpluCKxMDOFwfOUzwlqSWdlR4ceQqlirdRUwgB8uQb2aWvFsPl200D6 M7TdfokN3x0DIX6OKRSzDju0Ta1/3uzmfUTwgBELbjN0lleVCqEDjtIUMiJRLjNEm9Oq fsvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=MBpMF/fYSDpdGZ9EitLQmyFL5rn8F9s3A6wf1W27BTM=; b=e9K7w0MHcjbpop0QgP6cWknaB6YYdKU++trEvujTpYEqTO2WKB//uwfOR5tfONFFN2 OUlDweXG8vWUaHTyo0Z/F2IbnIo9IvUscw4/KXDA5GXN3NGXaWQdKmT0Isdh94nZLCnD gzWQiWd/P+mjjPTyAbM63eSpCCJs9sR9LeFAwgBUz2T/v+1+Uz9TQxJqiO1xBpe5NU1W DoT5QedntWXAp6DjOBLUO/A3eOWjml+i1w21XIiLSFJTZgiKDdRLPgFHi2951mvEpAki fhnx5hgV+iftsbwU/qZmUPxK1SZhhZEESs7Hbjg01wWPHnwiET3IinHd1/Eh+hx1v5BZ RB+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15-v6si26027097pgn.498.2018.06.07.08.54.04; Thu, 07 Jun 2018 08:54:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934187AbeFGOiB (ORCPT + 99 others); Thu, 7 Jun 2018 10:38:01 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40462 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934178AbeFGOhz (ORCPT ); Thu, 7 Jun 2018 10:37:55 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbo-0005Zv-Ng; Thu, 07 Jun 2018 15:09:48 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb2-0002sG-SY; Thu, 07 Jun 2018 15:09:00 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Greg Kroah-Hartman" , "Oliver Neukum" , "Hans de Goede" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 136/410] usb: uas: unconditionally bring back host after reset In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Oliver Neukum commit cbeef22fd611c4f47c494b821b2b105b8af970bb upstream. 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 Reported-by: Hans de Goede Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/usb/storage/uas.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -1195,20 +1195,19 @@ static int uas_post_reset(struct usb_int return 0; err = uas_configure_endpoints(devinfo); - if (err) { + if (err && err != ENODEV) shost_printk(KERN_ERR, shost, "%s: alloc streams error %d after reset", __func__, err); - return 1; - } + /* we must unblock the host in every case lest we deadlock */ spin_lock_irqsave(shost->host_lock, flags); scsi_report_bus_reset(shost, 0); spin_unlock_irqrestore(shost->host_lock, flags); scsi_unblock_requests(shost); - return 0; + return err ? 1 : 0; } static int uas_suspend(struct usb_interface *intf, pm_message_t message)