Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp45765imu; Thu, 8 Nov 2018 14:29:58 -0800 (PST) X-Google-Smtp-Source: AJdET5eCn39Pv3rnMlS9oH6eD3bwIMzHd21xIKQnHpFJARZQ4wz7U3CSGYLJlZp8cVnTX6iu7Dlc X-Received: by 2002:a62:c6c8:: with SMTP id x69-v6mr6454496pfk.37.1541716198274; Thu, 08 Nov 2018 14:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716198; cv=none; d=google.com; s=arc-20160816; b=Thh9Fst/2ObgTTxafcGMXqRsG8uiZ5HnGOJgmPqIsX8okDaqYSZn8/+emfIbLsIe61 Q21khJef26BHqXUUNSuSUf7uhUNb9vRsaFuKUMqxCL+jochSltjbqXSKMZeHuXfyk8/i 5rj5Qh94RtZZgXwQI1aZQTdaCNnoeXv5xOgQYO+oNrinBqo7ntV9uc5jSkFW/aL858cI /5ce8mpnbvne6DqrRL7vJBrNlEeXk3VfkcJ7YKCPFURxh5qC2RSPFZ4BZFrh0vevixhY u34Gyxy4pm4I1L4KKt+9J5gbsEAz5Cz0eJhlzRoogp9ydFc15YBgW5EeqzwR0oC7UAZr k53A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xq5YXBgidw3KoysOo7D3dn8kLs89+xqHnbe6DdRZORk=; b=08nJaoeKHfpSG09EyQdPGxh8pnpPpZMkBBRcEGorrPZu/b/owIELmK18KPQytrAC4E qhoc6YVJEY6TuAtVltVbipiC5bA2QKb62rknUvN/12CXyUn/HJ28aUg+e1CTc375vyns mn6IVpRKGxAtHFQDOfVYqCVt7F1lf7goU1d+GBeH83jgzpTtFkdMA5FO/lRqPxS1sThf nSvly0EKJXg9g3Pd6yexl5rW8vbjqTLNSvRfIvRvBPbWENhgfVReBxw0tIAGE6DKRwTX qNozPXEycJAkVaT+gvyrANaoZsTwo29kSJtPIPGJh8bIufkIMpu4qTYp7aH001Q545Vw Dpbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wvmyNnVt; 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 c18-v6si5407071pls.155.2018.11.08.14.29.43; Thu, 08 Nov 2018 14:29:58 -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; dkim=pass header.i=@kernel.org header.s=default header.b=wvmyNnVt; 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 S1730794AbeKIHih (ORCPT + 99 others); Fri, 9 Nov 2018 02:38:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:57940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727602AbeKIHig (ORCPT ); Fri, 9 Nov 2018 02:38:36 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 453DA21479; Thu, 8 Nov 2018 22:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714467; bh=71PEbRKgNwv6pIjyfPyAQhZwTsZq5Lhde5gPaYZoYtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wvmyNnVtRLgl2X0vgzLwxHzSVU8/530Ur2ThMKeq8ohxz0EVnCywjZ0isde2lDqJ5 X1klxB3vhXmlGoFEVzpkkYyR4/iAGp9ZD9edVZmUCxBDdeL4EwPpQ/HNpKnjtVXd7V ixLwy0nVjVCqGsgJhZirDz1HG8Le9cWf6o2xUgVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Tejun Heo , Sasha Levin Subject: [PATCH 4.4 103/114] ahci: dont ignore result code of ahci_reset_controller() Date: Thu, 8 Nov 2018 13:51:58 -0800 Message-Id: <20181108215110.046988855@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. ------------------ [ Upstream commit d312fefea8387503375f728855c9a62de20c9665 ] ahci_pci_reset_controller() calls ahci_reset_controller(), which may fail, but ignores the result code and always returns success. This may result in failures like below ahci 0000:02:00.0: version 3.0 ahci 0000:02:00.0: enabling device (0000 -> 0003) ahci 0000:02:00.0: SSS flag set, parallel bus scan disabled ahci 0000:02:00.0: controller reset failed (0xffffffff) ahci 0000:02:00.0: failed to stop engine (-5) ... repeated many times ... ahci 0000:02:00.0: failed to stop engine (-5) Unable to handle kernel paging request at virtual address ffff0000093f9018 ... PC is at ahci_stop_engine+0x5c/0xd8 [libahci] LR is at ahci_deinit_port.constprop.12+0x1c/0xc0 [libahci] ... [] ahci_stop_engine+0x5c/0xd8 [libahci] [] ahci_deinit_port.constprop.12+0x1c/0xc0 [libahci] [] ahci_init_controller+0x80/0x168 [libahci] [] ahci_pci_init_controller+0x60/0x68 [ahci] [] ahci_init_one+0x75c/0xd88 [ahci] [] local_pci_probe+0x3c/0xb8 [] pci_device_probe+0x138/0x170 [] driver_probe_device+0x2dc/0x458 [] __driver_attach+0x114/0x118 [] bus_for_each_dev+0x60/0xa0 [] driver_attach+0x20/0x28 [] bus_add_driver+0x1f0/0x2a8 [] driver_register+0x60/0xf8 [] __pci_register_driver+0x3c/0x48 [] ahci_pci_driver_init+0x1c/0x1000 [ahci] [] do_one_initcall+0x38/0x120 where an obvious hardware level failure results in an unnecessary 15 second delay and a subsequent crash. So record the result code of ahci_reset_controller() and relay it, rather than ignoring it. Signed-off-by: Ard Biesheuvel Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- drivers/ata/ahci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 34fdaa6e99ba..5f1f049063dd 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -619,8 +619,11 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev, static int ahci_pci_reset_controller(struct ata_host *host) { struct pci_dev *pdev = to_pci_dev(host->dev); + int rc; - ahci_reset_controller(host); + rc = ahci_reset_controller(host); + if (rc) + return rc; if (pdev->vendor == PCI_VENDOR_ID_INTEL) { struct ahci_host_priv *hpriv = host->private_data; -- 2.17.1