Received: by 10.223.176.5 with SMTP id f5csp2834743wra; Mon, 5 Feb 2018 10:38:25 -0800 (PST) X-Google-Smtp-Source: AH8x224hMfgyxK5xIKbjU/CZYiVWnrvXSy7L5zFG7WqM8wDn07cI02sW+TiuAh/qinBdHizY+2GW X-Received: by 10.99.164.25 with SMTP id c25mr2513599pgf.308.1517855905248; Mon, 05 Feb 2018 10:38:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517855905; cv=none; d=google.com; s=arc-20160816; b=nrXi+m7+HMZSWfM6pLgixD9KC1QBEgDxLQwk5D1AtbbbhfVoFJPOT30/ph2ELZ3TSw as6b+3nUF/wnEbg3A3E8F84O+lXxftWgJnW8l5CctT6Z6ZycJUa6qPMuPPbahLe8YpcB LOtKq4ZYEuIWPo9uPRqSFHXYmqvRzh1su/muXbtNCTTFg06RcpGOmWPCbCadD35y7fo/ GmPHJAdkcS0VFKT+WJIJ7prdKMYC5YxAU6lOVwoFSmWktV0dRmjDoJiXPdZADy0fTM27 +rV4kGoH/ZoIP7jgm1DR5M4J+jJ/2IL5L61PzjDQGdF4JpwSAc5PCEypqyA/ALTk9/Zv kh2w== 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=3klMqB/3DRSpGSdRXmSy+dEOfXLqjfWbXlOP0dVlFUA=; b=IFp9zU4U3gXTeKhodaoc8G3i4vvBSJmql7FLJhC29zRRKhGxYUeu40YHwON9eBUT0w yupdyCk5UH8jqpP8IeLVg+fhJvZNIxJX35N3wBjNMywO2XBKz3C2StkSuB2SWIni2jo/ paUmJFszAfJS9VjkotaeveozPDZVB5GDeQWw8Q8YBdY5qxOl1NokV4P7IKcmAA2WabGG beDpbce1afQg6rKo6Nv4kXZSEIoyubIsRF9M18E/WwQuyEALWN9VvuFsS19H3Bw16DJp NDFtF/E8aKtm857z8zH7U8e1E/++InYz47tszScBN5Pyn+GUp/u1tC5mJywZ1FjuRGGh QVOA== 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 j3-v6si840438plk.506.2018.02.05.10.38.10; Mon, 05 Feb 2018 10:38:25 -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 S1754078AbeBESg7 (ORCPT + 99 others); Mon, 5 Feb 2018 13:36:59 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54210 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753717AbeBES0w (ORCPT ); Mon, 5 Feb 2018 13:26:52 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2DE32C93; Mon, 5 Feb 2018 18:26:42 +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 3.18 33/36] usb: uas: unconditionally bring back host after reset Date: Mon, 5 Feb 2018 10:24:01 -0800 Message-Id: <20180205182353.135559339@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182351.774761393@linuxfoundation.org> References: <20180205182351.774761393@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 3.18-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 @@ -1067,20 +1067,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)