Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp29134imu; Thu, 8 Nov 2018 14:10:29 -0800 (PST) X-Google-Smtp-Source: AJdET5dmftKhSq8RvtrfkCXg5UyIiox7YFd2zZLb+7jBQ7CEcpH6qB3WUftP8AwpM2fFwOGmH/2z X-Received: by 2002:aa7:8498:: with SMTP id u24-v6mr6327957pfn.220.1541715029915; Thu, 08 Nov 2018 14:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541715029; cv=none; d=google.com; s=arc-20160816; b=wR3LLDKcPXzW0g7rhI0u3UiJBEiahOZU+BkbwF9dVadXBor8AwRGYc9FlIMnNeBtCK bfNhKq7xDcbLIvymLUYrkV47EXS+sCfeBsVh+MfCzsN50gDIX0lxBhFoga0SDL2lce3A 2EX9sCYbWC/TBFexOKxS3WJoJtiNsvlPCVcCd+sNHH4Gn8Q0ArmvDk3VxdcMLQ9gvBzE zUDQnQ/VZF+gvj7oskVHvI2vMUCl1WWp9lHKQedbvS0qwiSIaxAG34B5fcvI9Yn3rI7o Pg6mHIGt99b3BB6eIbEEjibxzrhlP2DD2tLWiCy+G44qpB1XARmtfN/u5lkRbRI2ymDz cqbA== 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=+QQWcgRZ5HwMyxfQ2oRDxhVxGS0i/IxcxQmPvHZHeu8=; b=G2JMDVExf3mn0uafeG91FFp5edVOxP7xzZFnzTzTMJPCb6f1c3CNUQEBRgMQsotwdN kECNHsGGr6OT+fbXibIuA5zgxN/OugQEIp6RT8k47HIuoBs1oVx9qaly+t5HASKnHCrt Ja4ITBOEt8jk4V6kX4MfrS6sP22nz56mQsEvyPmIQvQa4FRuryPBgeibgl0v+ZDP64bV y/u7TAHEV5pUCH5vyNbyiEExPIM8kkLEu/v7vdG+D1heBnkqlBBDePiPQ1th/G6qSwlM c8woFR/vHTW8kqNUbM8nhEQliMNL2JFSj7C4HVWnz3UxwkPmDte5swXeEAmdnhpgp9LK F18g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MdAxSB2u; 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 m75-v6si5087331pga.481.2018.11.08.14.10.06; Thu, 08 Nov 2018 14:10:29 -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=MdAxSB2u; 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 S1732256AbeKIHon (ORCPT + 99 others); Fri, 9 Nov 2018 02:44:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:37818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731066AbeKIHom (ORCPT ); Fri, 9 Nov 2018 02:44:42 -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 756F92146E; Thu, 8 Nov 2018 22:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714830; bh=vq90E71dVpR6MK0H6RPD/g7VAIG6Ix58hmtNjTEvPVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MdAxSB2uihJ/gmSQRRS0BIcKGaqkwBBPoGdxa9oMMwj1m59EoGyEW3CiUk/skRXGy nSdCTw+b7n7DAWU0dM6++Ilsf0td9AO0keKixDPT0N/oF9ZgjNDtF9LNVOqAoQHFNb 8IpnEgJVV1HkmoPzfPDaGf/o/a+XkrNGXavTih4c= 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.9 155/171] ahci: dont ignore result code of ahci_reset_controller() Date: Thu, 8 Nov 2018 13:52:05 -0800 Message-Id: <20181108215137.975075155@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215127.257643509@linuxfoundation.org> References: <20181108215127.257643509@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.9-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 faa91f8a17a5..5408a292078b 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -624,8 +624,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