From patchwork Wed Dec 4 17:56:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 180836 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp946006ile; Wed, 4 Dec 2019 10:13:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwbltRT0j6C6fJsICn0J1qU9KKKbVcp0e4HGEpxrDchMTsS39EoJXVZwk/+xPAoSzHs0nkD X-Received: by 2002:a05:6808:aac:: with SMTP id r12mr3720036oij.59.1575483227169; Wed, 04 Dec 2019 10:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575483227; cv=none; d=google.com; s=arc-20160816; b=PKNr7PvHS5i7+U91wPYJbCgZQp9hSPgPUPL/CsHfvAEWrGOf0Ovguy4pSHtCDtCst5 ftXWqVSSDJrotp+fpQ2X+5/qZm6tXQ8TU6oVQCs0lLmSwCIStO8fvyke9kzLGDKlqH1b ys0wdPCDWKxRKw3pfIlr3wEdwG7FR2gc6rLgZ9utQX4mgJBFuDLnU55eU2jbZ73RT8My MMitwAVd0gfYiILz5mp/alWahz5vnh1MKueBfx1vJ0ozSsqJQRld/F1rrLfBg5Fxpjwy w9tVg5OXOTtbnqf3eECNTDMe0YqU/Jk0XfkqR5tv+E6/iTa5Kwxy5Ol4qusRYAStqo7+ yaCg== 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=Bxfp2O+s/oo66mvXtDqgd2IZxFiiHqGaw9pUveLOYVs=; b=JdQjLPdhoDVd0xlaMeIOyZQaDukIbJzQHAUZ/dfgkjILmd3jICKvNLVSqNcHL9plWl GbjJphiT3pspFLrq7KOwf8l1OnR75ewthwR7CpKQTdnnLojT8ZLAsZYZOJgV3wMDMQx8 ZQEweejRu3t51JlvxUsp8tB+pIqRBwR8zHxNQas+RbsvR2SeiTZV5bx1sBrd1q8jWUAW ok8SIGCEIu2yip7WZZRVO4KZyJ4Npk/VZVru2XXys6euwhb+IrRZlI0ktwiPPTPXs4cC esP3j1QexP223yr3TN1fHouF+UEtxWrWnmwiEqXJ7VEONE0pLcuaMrIKyCscT0EKOv1N xV2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TcLcVngn; 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 w138si3601487oiw.46.2019.12.04.10.13.46; Wed, 04 Dec 2019 10:13: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=TcLcVngn; 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 S1731813AbfLDSNp (ORCPT + 27 others); Wed, 4 Dec 2019 13:13:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:42926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731790AbfLDSNm (ORCPT ); Wed, 4 Dec 2019 13:13:42 -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 9CB74206DF; Wed, 4 Dec 2019 18:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575483222; bh=F8bm6cUbhQzAHQ+PL99yZE/aTt2ybXW/03/U7caOBbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcLcVngnVgLJqaoWVwbfHyrj1p1RBwxl+oBKl5tMZbKyCnB0x1Da8t0Uonc0CDP3g 9/z/uce47M1Xhz1uXgXMWEg7NnP5Xe3JNbP6+6yXhiH4SLu21yU+vtn934LJuEmmYa SsAAZTtNghDzoHlUzAq9Fz93zmdLXiKaQWzjNJ7I= 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.9 102/125] scsi: libsas: Check SMP PHY control function result Date: Wed, 4 Dec 2019 18:56:47 +0100 Message-Id: <20191204175325.315574058@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175308.377746305@linuxfoundation.org> References: <20191204175308.377746305@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 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(-) -- 2.20.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index b7e4493d3dc16..7e8274938a3ee 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -603,7 +603,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;