Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4565119pja; Thu, 21 Nov 2019 21:58:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxPH0ZEXHYw4uy2Z+f/BH503suxEr+VmFQnrXVim6txS0VtiEtKtQ99B4XVnTtysJt91kc5 X-Received: by 2002:a17:906:8054:: with SMTP id x20mr19261207ejw.68.1574402327052; Thu, 21 Nov 2019 21:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574402327; cv=none; d=google.com; s=arc-20160816; b=qlVqUgYLg8KpaLhnyHFPsnZeAYoEJbNIswPlo7yGvtwaX/nz9SbYPJMQahPSSSddmy dU2HH2gV2lJnGYHiLghodBXZoJqwMMiCH0ywfksaEEj00atmBDfpt+XMMX/1LpbqwoUk dmGvr2xH9QKoWy+zPWzigQxW+Zyxz/ww5yxIVpnvfMbDH5k36FpdLjBHrOTkKchnLGAR aFTw7xCzIpFFmTWRtXmi1UqytcsW/qYC+hKAw9R4OyOhF1PzPW5xZNEtmdA7e0QG7Xo2 4K/f/DsrO7zLScHVR6Utily3ZGcTuSRw8bTNo0INiNe10PSGjCNncc2GlolqVir9wJOD mhwg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5kN/G46cjpjtUE3jcvTfYD50AKbhxjdHtQZPbRbZgwQ=; b=Fna8rKvqaqVkGJE6b+dIujVV8IvTIVagNx5JX8lsKCri6XnvTO2ViF+X9995d1HfES zlU/OkliyqzJ4/sij7312mOCX+gFP2GRzpmU4SWTj4oqgoLtGc1Bw2V1amANzju7I1WE QcsWcarSeLC/w3UHgNYlDUSKscDQnAPuCKHbFe6C1Bee+56k3aadewdJ86jXDkDEmfLy 8xg9kOa14WWII4vaivlNCPN+r/uAJRADUIHygJLyR6n/Efw3Ij3WBS3sJe8bW8e/pCgj +63TxWz2uI86wpdA3GJUGKVFG8jlHkQmttFKGZksJApnQ1/uCHoOJKwCIx+1ljNdnaMJ hXcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JLA64H4z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o23si2287523edr.408.2019.11.21.21.58.19; Thu, 21 Nov 2019 21:58:47 -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=JLA64H4z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728907AbfKVFyK (ORCPT + 99 others); Fri, 22 Nov 2019 00:54:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:59226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727637AbfKVFxN (ORCPT ); Fri, 22 Nov 2019 00:53:13 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A28112068F; Fri, 22 Nov 2019 05:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401992; bh=0bjOreP6UDoqpGwH7kw2cdj5GUpaPE5SJN+86FJfrLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLA64H4z1E5/40H1Flsih58h+5WRau2VHyhBWRUcJEug0/c+VIOaa2wmD02ijL8Cs N9n0Yh63TsjS/xf/B899pCxgNjav0rm8mbUTYi3PO/isTk+sjXneEZ3tDmk8ITviAk 3I5XSruvvJTGG3pirU1eU2O+XtM7TRyVHgj2+9ds= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: John Garry , Jian Luo , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 210/219] scsi: libsas: Check SMP PHY control function result Date: Fri, 22 Nov 2019 00:49:01 -0500 Message-Id: <20191122054911.1750-202-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 23b5516e80304..c6ed75b6abeec 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; -- 2.20.1