Received: by 10.223.176.5 with SMTP id f5csp1050492wra; Fri, 2 Feb 2018 10:18:15 -0800 (PST) X-Google-Smtp-Source: AH8x226tTedPTPQVcUfFZnbaaQdr6orqQJcmwGPNrvPIUuCixYG5yaQoBAhbHh/AXeXs97pKpnc6 X-Received: by 10.99.113.20 with SMTP id m20mr7459514pgc.400.1517595495733; Fri, 02 Feb 2018 10:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517595495; cv=none; d=google.com; s=arc-20160816; b=RnDzssS9dvWgZxNuXMBQ+NVDX5re0BmI3fgAaJkdFkRxHATW+c86Rdppk3ef+UOQTl 1odMqkoT+uM174kAnLb3iQyaofrZwszYuDRm5iZ5GM2wJ3b5Yn+iVcb+Baj41igUVvyL z8PwlyPGCPMufYeUxbfdh4e9MRI8x+8EA5KVzC2fllh/t1xhO6Gfd6j718BXUw3oWw5O zUeowJas4q3dssEi4JK35Pqo3uEC4k9z2+84yimdHa9N4CaHDV3PbsvSW1NiHK/29xd6 ztq0tCQ4iLS0n4CIZ055Grzi+Ui+2wKTEix/gixfdESo+rRN0Tehrqlw6L5y8wapCp3o bNmw== 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=Te7qtmHhImi2V88Ur4wUA6Eh9/Ha3LL+a804U5rIxEU=; b=VSIBQv8GEC9R0OlQO/1fKJAVRBm96iaoE6QOQPQOPuiTHRtXWynZXcwUYWn4Va288P 01QYgv9GAtoi1nNzzrBKdd1CojNS979M9blFEO+uBn4Cn1GNIxHcLUEl9Kx8OglzIIqH 5oMaHF55HHTzHBhip687iWYGTDlZh29M0oVa6NwqsKMOds/I7Vglc0R1rl8FJHr9eO4x atG7BpFZjkHp8W5hM4csZE+/sKjVKotmZBOvBY2dLQg+7jtizBt34t2Lh7pogyYv17VL NfE7bIassh1d4SpPK8G9QbmKej18488BdxLj8tFWSorX85qAd90DIMIpU+hkfj7EW4wI Pzsw== 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 94-v6si2293543ple.298.2018.02.02.10.18.01; Fri, 02 Feb 2018 10:18:15 -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 S1752969AbeBBRFK (ORCPT + 99 others); Fri, 2 Feb 2018 12:05:10 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35464 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752768AbeBBRCf (ORCPT ); Fri, 2 Feb 2018 12:02:35 -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 EFDD8DFF; Fri, 2 Feb 2018 17:02:34 +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.4 64/67] usb: uas: unconditionally bring back host after reset Date: Fri, 2 Feb 2018 17:58:33 +0100 Message-Id: <20180202140822.268335379@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@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.4-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 @@ -1052,20 +1052,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)