Received: by 10.223.176.5 with SMTP id f5csp1125732wra; Fri, 2 Feb 2018 11:38:11 -0800 (PST) X-Google-Smtp-Source: AH8x227LshuTql4JgYT6U4tx7cwGEZAnUqQ2iIL/w7/oYAokpzi5vXi15nzWNS6q9FcZnLGS/76t X-Received: by 2002:a17:902:33c1:: with SMTP id b59-v6mr27187481plc.111.1517600291878; Fri, 02 Feb 2018 11:38:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517600291; cv=none; d=google.com; s=arc-20160816; b=b/MxwXfQBb9Qq7WOOCBX25BT8fW+sw3bdinboX6YhhsJtdsxzEYa5rpO4E8pvPiNZs YsHiSjp2BiZqCjE0ml0iXLEo+H2bvAUfnW9huL5Rqp/VTdWwJKOaKMAYL0HJnOZQd7I9 QXC2lsKxIATGR64YnYrTTYDWyTvlpsXVJcSJ+fTv3P5rNynmOI899Six1q5/QCWbjT/U xfPkTjASz6EmDr5XV42Bm9ji+NtS9apqiDiyw4Xduc1j/+7mtZyacIxPZKPwDTGwbv9N fIukjvCKFZyWQOZFsIEmFZrLoa8INX+/z6/9hsMsNfiKHZkXOveWws+MJj6khFdQLBGY pKnw== 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=N+nAMH3TkAwTCItJ3g2+CeUCQXWjR/roU2shImTTTjk=; b=kAVBRmeAAAYV9LPrJTzI4HIFuFr0rwJ6wzgf2w5EVnJfo+1GwoL9HYlzXbvOrz3MvD He+Q83LVae4qK8+9KHOP1AxR8XTQsQE9kTqaDfwlsGIxkUiLPW8SBhpC1jL98/6wz3MT v9nTfYMXFUeZAGsfEJEXdu6KFmTbEC1Tz3abAysi5gFCV1utimW19fnZmsRg/md3dtnL dVJDSnh1isBvVAsfcIrSBx7W2K5sQ3cQuC/51LjI7/uF139FldcH357wPxjzMhYX2Y3p SnfNZ67qqpN1/q0GdeIu0NomQX09LD48rWe3MZf7E9H5fNBJpbwD4GUZGQ2rVbB00ADm rl6A== 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 x11-v6si2331517pln.665.2018.02.02.11.37.57; Fri, 02 Feb 2018 11:38:11 -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 S1753386AbeBBSOF (ORCPT + 99 others); Fri, 2 Feb 2018 13:14:05 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36794 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753107AbeBBRGc (ORCPT ); Fri, 2 Feb 2018 12:06:32 -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 447D9E3B; Fri, 2 Feb 2018 17:06:31 +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.9 82/86] usb: uas: unconditionally bring back host after reset Date: Fri, 2 Feb 2018 17:58:42 +0100 Message-Id: <20180202140830.169784420@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140822.679101338@linuxfoundation.org> References: <20180202140822.679101338@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.9-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)