Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp666024pxb; Tue, 5 Apr 2022 17:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoHdnIvlKcB2PQgllGJqBTwqz1FkF7tvsR8aFXtqj1x9z2qVQWeN5IwCheby7UbH6YV/2F X-Received: by 2002:a17:907:7ea8:b0:6df:d4a4:8156 with SMTP id qb40-20020a1709077ea800b006dfd4a48156mr6113062ejc.226.1649206659254; Tue, 05 Apr 2022 17:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649206659; cv=none; d=google.com; s=arc-20160816; b=hIWkelSSdbImYpVI2NIyS8y9krDQsiPsAZsRpytkMCG1deZSDA0+BCgCwy1V18YzGm Jq94JBeib0NIHR1DfgNMZkGkiU9SpYW1MZy0lSvl03B/02LcQrMmZi7LPq72H+aO4ch7 b1PYsRmfsfScvH9nwmuZAbgujquWuiowRU+91p2omj52qlhUQo5TzvJADg+8LgrL9CQd b/vDQCSnyMOvcaMSvLkrAXfSEKPNsUA0RknO29cIOfyu//7K16xYIVWeohJEZN581cJG 4nY+J8A358qdhcjljIn2WyUmg2n6BzbMPXThNtOuV9UaX1lpJ7HMRWWaWYfgPsQK1Kqq Jkwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BIjHE+/7x6wHbs+fVRiJksx4RHRlK9KFwAxKnWoG9KA=; b=AvAl84mjS0RnvBA7MSHxysPtTbKhFnxublw7UpnEz0vNxScBjV4IHnhuVYQTKUkmjG 9eoQNda5vQlV6nLPOAwEyOENOYqxoM1wmMFjJxgFsyvKjmmKtHmB6LqiUTe9QV3Zr/gC ceN61KCYWLGe96+Gudp14iYkHvM9xLTorjHhvtKkcfeF1wNLQ3GMSZzxnyimP8uqaeM5 /xibnumoBiaUXp66OsgUu1W2IGT0oQTdL8kNVxDX/S3tjMh31kQ9RMoniM7cv0wB6v9b s8VcnD/KL4cn3hLr6tRAohqWCCLD6v/vjex7UgS8Urp491MHphEEAYZZdMS5BdbcIgNA //Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YG9gp4nm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q1-20020a17090609a100b006df8839b405si753475eje.640.2022.04.05.17.57.11; Tue, 05 Apr 2022 17:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YG9gp4nm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387380AbiDEOb4 (ORCPT + 99 others); Tue, 5 Apr 2022 10:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240502AbiDEJe1 (ORCPT ); Tue, 5 Apr 2022 05:34:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F09FA85BD3; Tue, 5 Apr 2022 02:24:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7EE1F61574; Tue, 5 Apr 2022 09:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 918E4C385A2; Tue, 5 Apr 2022 09:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150642; bh=hzFTItGk6MhMLG5gB5eFJka/S3aQMbJUpwbjLiXXVC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YG9gp4nmXE0t73DZZuXcZ1GVVyeek6TwFcOclTL/n1fqI679eKQDcAfbuZXHoN7zq WCUYVr+quHTWQW+5OAKVoh4XuZhgYO9b9gdXd2Eb1A+I2sXZSlt6db0WS7U3nqyfH2 ezEET91yGv/+E3JV8eaqXNsOiOSZ4WCzLo8ydcpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Jack Wang , Damien Le Moal , "Martin K. Petersen" Subject: [PATCH 5.15 090/913] scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands Date: Tue, 5 Apr 2022 09:19:12 +0200 Message-Id: <20220405070342.521365590@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Damien Le Moal commit 8454563e4c2aafbfb81a383ab423ea8b9b430a25 upstream. To detect for the DMA_NONE (no data transfer) DMA direction, sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. This test does not include the ATA_CMD_NCQ_NON_DATA command as this command protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and not as ATA_PROT_NODATA. To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA direction, use "!ata_is_data()". Link: https://lore.kernel.org/r/20220220031810.738362-2-damien.lemoal@opensource.wdc.com Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA") Cc: stable@vger.kernel.org Reviewed-by: John Garry Reviewed-by: Jack Wang Signed-off-by: Damien Le Moal Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/libsas/sas_ata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(str task->total_xfer_len = qc->nbytes; task->num_scatter = qc->n_elem; task->data_dir = qc->dma_dir; - } else if (qc->tf.protocol == ATA_PROT_NODATA) { + } else if (!ata_is_data(qc->tf.protocol)) { task->data_dir = DMA_NONE; } else { for_each_sg(qc->sg, sg, qc->n_elem, si)