Received: by 10.223.176.5 with SMTP id f5csp1012242wra; Fri, 2 Feb 2018 09:41:09 -0800 (PST) X-Google-Smtp-Source: AH8x226c/w16ZKvRhNVoK6IFVj1Gb1352wVMh+ATQmJJb9Ad54lGbqJ7wiHPI8IrW5zRg9/v16H7 X-Received: by 10.98.87.2 with SMTP id l2mr40135195pfb.46.1517593269388; Fri, 02 Feb 2018 09:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517593269; cv=none; d=google.com; s=arc-20160816; b=Zle6lp+deRKPcLOvmfHlPWohYbdjEs5Xc5p6OjkP+KqaM3EOVCkkJGS57GclyWssbu HRBc1MxAQwIIpxu6g7GLSSVkj2uIH5rGgn8Mvr7wCzC+4/g99/PJmUNO2M5RHXjh6zzd MoWAB5FZGscwSxq3WDs6OKQOcAQIWRedftj6tkkTmUM0nlbIoDfbwF016zNTYGifu3yV HxJbzbO3EKmc7rzBWJSqS4C/TTxe3xsQsAjRbdK9wo85hu1GCU4XRlZMejbIkdIXkFfC +UYQ6uHcZv0BVPJEdcgsJ6ZgILI9RpRlCN1eTet7AfyYRVLKyD3LrXlPEGsMCc2zdQ6S WBLg== 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=jR8CS7+x9oTMQX927gu1ze5fAAijyaxPse+lX8MTRF0=; b=LzU1/8a7meUz/Ej82V+MjjnnGMCHDc7PH6IV2LshmMRi1T5jvuAXktkAxKR47T3lxW mhfFdjRPDw2E0cMLrMXuWWpxBIw+MU6/RbQ+P3DES16cZ3zbW2tlbouG/KcAnYd+7tEx EqtMpKBw43Y1rI55LMdCDrnVRuWOeA3eXU6KVjAYcdAvZM082qHEsQovsh8swGJcPBDi IiE/e52c53L1FC3W/bod1EuOQJd5yaQD30kk+JxtbSRa7m200pknsVvZPg5IUztv9XDS 4Er0EyMMWl69eDF9I06oYahObnryBvsNT2BCqeMnp8yIs5jZbc5t6Bmu7VFthcv11E/D D8uA== 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 66-v6si2212791pla.131.2018.02.02.09.40.54; Fri, 02 Feb 2018 09:41:09 -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 S1753522AbeBBRj0 (ORCPT + 99 others); Fri, 2 Feb 2018 12:39:26 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40982 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753828AbeBBRQT (ORCPT ); Fri, 2 Feb 2018 12:16:19 -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 15CDFED5; Fri, 2 Feb 2018 17:16:17 +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.15 40/55] usb: uas: unconditionally bring back host after reset Date: Fri, 2 Feb 2018 17:58:58 +0100 Message-Id: <20180202140830.080568661@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140826.117602411@linuxfoundation.org> References: <20180202140826.117602411@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.15-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)