From patchwork Wed Dec 4 17:56:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180844 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp957433ile; Wed, 4 Dec 2019 10:23:12 -0800 (PST) X-Google-Smtp-Source: APXvYqy5kCpu+IngaY76X+/y2VtwMxRBtKaCZ6wlrFfE/KT7Ffz/dONcxETYp/FGCkq3tqb9r8Bo X-Received: by 2002:aca:d5d3:: with SMTP id m202mr3619150oig.161.1575483676670; Wed, 04 Dec 2019 10:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575483676; cv=none; d=google.com; s=arc-20160816; b=MhTjlnH3YnWlSQOOM4FHPy8ka5xiAeJLbGXYAhC08SRDZrCq1lgut+l0acWg6ANw5f /ATsLg+b0nI9jHss1yiFAL2KjxO3IKrhH8TRIBLs+GC4MM8BJHdO+Xu2FoSrDzbCd93N Ay9UkO3orIFrmY8EwE9iI68FnEbAklJfv9+3lAEBsCibfkfq0xQIPcMYZ2wSfqCLFGEG Zap4CPasU+KVqcPr9yFpm7E2+5/G8B9OqIvApOcsqGZHAJp8CkpAMJQXg872zKHL7ULg nt6SfsV48mEQFA6sTTW2fraB3sHtJ02qk75AUQTehmrrprDzk1eUt/b7vmsTerIBHBge H0fw== 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=028m8Hb6ehXnVkEEifGcBTFbCqpvAgp0x6bs8s8r2rE=; b=nvIidE0gworyZh2vy1u3+GLyExGrtf2pjmyHVRN26537GrjXlauX431U7MCRT5JiIL +KFLhHoFp3iBCBFeM5iS9r2X1ELCWQ5n4YpkLjSKAAx4SulP+sQCBlfOlWT9maZEMZt4 LayuWw8KmbNbje7Z3nJKLbeeD3s6NZRW2CE0j9/TP1owWpWaIWbNoZDaNu6Qev7dWtn7 aohCxqCVhSAxrYyzyXnA/shrerSar+DEK9r1ZMy2NNDq1eVxhJWhKMOizU7r7XJhfaix Mt5CeRt7GwnxFFsP8nsCpjGWR65ZrqmKeadjlOTllipp1AH+J1Un1mddodQAq/ud5jgA wtuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rQui2GjL; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 v2si4376907otf.58.2019.12.04.10.21.14; Wed, 04 Dec 2019 10:21:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=rQui2GjL; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730162AbfLDSVM (ORCPT + 15 others); Wed, 4 Dec 2019 13:21:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:56578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729039AbfLDSHK (ORCPT ); Wed, 4 Dec 2019 13:07:10 -0500 Received: from localhost (unknown [217.68.49.72]) (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 72A8120675; Wed, 4 Dec 2019 18:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482829; bh=2m71RfjpJMhsE/hnMO23RQYRMaw/9glv4FzCsCZ4loM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQui2GjLfDTqEpVBBhzrgtYOMQXY0oWUKYTxO7pgJRQONBdQ1T5EMfKWVhQjuCO3v LAgnuihfW0EnFNmhmZ9RPU0dSTEtx2OhcgNfNRb7B3/lC8vB/S4Rcxbu3xfn6icHsU UdyC7lKI+s3JMaixBbEY94DBgCuF5ZHQWI+0o1j4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Luo , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 152/209] scsi: libsas: Check SMP PHY control function result Date: Wed, 4 Dec 2019 18:56:04 +0100 Message-Id: <20191204175333.958242641@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: John Garry [ Upstream commit 01929a65dfa13e18d89264ab1378854a91857e59 ] Currently the SMP PHY control execution result is checked, however the function result for the command is not. As such, we may be missing all potential errors, like SMP FUNCTION FAILED, INVALID REQUEST FRAME LENGTH, etc., meaning the PHY control request has failed. In some scenarios we need to ensure the function result is accepted, so add a check for this. Tested-by: Jian Luo Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_expander.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 63c44eaabf69e..f77d72f01da91 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -614,7 +614,14 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id, } res = smp_execute_task(dev, pc_req, PC_REQ_SIZE, pc_resp,PC_RESP_SIZE); - + if (res) { + pr_err("ex %016llx phy%02d PHY control failed: %d\n", + SAS_ADDR(dev->sas_addr), phy_id, res); + } else if (pc_resp[2] != SMP_RESP_FUNC_ACC) { + pr_err("ex %016llx phy%02d PHY control failed: function result 0x%x\n", + SAS_ADDR(dev->sas_addr), phy_id, pc_resp[2]); + res = pc_resp[2]; + } kfree(pc_resp); kfree(pc_req); return res;