Received: by 10.223.176.5 with SMTP id f5csp994598wra; Fri, 2 Feb 2018 09:24:20 -0800 (PST) X-Google-Smtp-Source: AH8x2276nd+FosCp6WGzwW7aC/GvF0FaPjmLgeaKv7X0XZfg0bPN+301w/AyRm4AzN4wUInm4925 X-Received: by 10.98.11.201 with SMTP id 70mr3013761pfl.16.1517592260540; Fri, 02 Feb 2018 09:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517592260; cv=none; d=google.com; s=arc-20160816; b=LeUJg9t9b6wUCI870a/50BcIWihrQvw1BL/pqj9zRzXbnZRLZqAh5W2gfTojCpyWoU H4cR92JGm6xiySLlAtfuq07YDZQiSAFs4PskraBT05CsFRXYW6+tcNrNm0Qrd8b/xbYq iNuIhH/2SYbxdZtam3QIMxTc1QqYjeAUfbjzt12yS/eC5qYJEpn4oy/eZFmuYOPndmoq LyqXH5OK4uV3p9r8xq2eGBru3u6mfIQkOnOWBAO6HnRaojh86LlqnQ+nAn/r/nFCTWEw ptQwz2ACMvuktbtkCw+A7tSJV+vhTddhKrpaGsOaxzXVnQk1EoI4Y/ZDcvH5+Mp5Jc0L jZFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FroMQGlpX0NGg2E/7I6NhA9ydCrlpg6UlkrAD5OvHy8=; b=CDYI6FNm+Q+pUHMdenBZmqztckWf31FnBVmDydsXIxNusHKKJiwlk+jgsWRHg8A//Z W5YYK9Evz9qFArSZc7qZTu6zPQ52RYaqW481KQkk1JrJlUOz9Cj1KEDoQJLIYb5vkOGK ESjLnhOdbBnDp3ucuMDcYU8Y+1jM5hkt/dIDs7j1rMKdCpLedFzULNi86QL1rHSV3WZG O0YbBm2jzTBt3eHkEWeuwfWZy3dyo/ADKMwHFoMbWgYY6gsVWZTg0M1E+ifdMwQ3y/g6 mA5QLWhjfxCdA50UcCIO1lltmKcUFu54UIpYslCB0voJNoCgKAwIJgnr8TSdh6aGrNbf Zb+A== 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 n6-v6si2157495plp.562.2018.02.02.09.24.05; Fri, 02 Feb 2018 09:24:20 -0800 (PST) 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 S1754000AbeBBRWV (ORCPT + 99 others); Fri, 2 Feb 2018 12:22:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39394 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753526AbeBBRNg (ORCPT ); Fri, 2 Feb 2018 12:13:36 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DF6DAF21; Fri, 2 Feb 2018 17:13:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Hans de Goede Subject: [PATCH 4.14 142/156] usb: uas: unconditionally bring back host after reset Date: Fri, 2 Feb 2018 17:58:43 +0100 Message-Id: <20180202140846.795807506@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable 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 --- 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 @@ -1076,20 +1076,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)