Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3621294pxb; Tue, 19 Apr 2022 06:46:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3vwv1zQuDWRMQpyHzStFptp8dE4h0fhgw7hzyPbuCjkgSDSO28VEGgKcv8LUCjDtuZVPO X-Received: by 2002:a65:530b:0:b0:382:b21d:82eb with SMTP id m11-20020a65530b000000b00382b21d82ebmr14831166pgq.215.1650375987673; Tue, 19 Apr 2022 06:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650375987; cv=none; d=google.com; s=arc-20160816; b=cfiVRpLj9oxOmoJIhKZEWhIirD1ikoa2nW+cLRXF+YSmMNMV/UTg28X9srD1ClUHUc uAoYrivrRpYx9UIgYrf8S47WMwC5hLZtZzpmZ9TQJpoYd0XKSoj711u/3x0KR9IC+HLR zzquomvQfJ7iISvyI688GjYIJhcYoSTHNzMDddh07TBaCKyPdqhRhqXNltpKOuLlFDZR IFi1U5f2Mg63jJKcazjxLnhFiSa0MXgkypqHnD8l7MfPGznmaKJjdlr8xedAkBq4zE4+ f03wy5+Cichw0I65cyG+b1a0OBAHnKcRzwJbYdJJ25auWBJS3M/2dhE7JEGeL4K8jl+7 dFIw== 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=ZjklEFGThail5EJ3v98GDmDl7vK2vl9/X9EojB1jouM=; b=q1VIQ2J9wmfBMsYklVjgL0bZrp9HII8XR/eYBzLkauCN12aMBNNs2VwHGYXHi2pUsu m2I/gCMscsEELHvR2JDj8/j1Yw21WbpP2wa1LQSLsP/NBmPzACte7NDkjaobt3DmuCPo hl3pYpRhbWIrwGtakM1vx9gaa1toHcJPJKewOGSv+XDjxXQPrRWS0rGLY+RreqaEA9Q1 6EIfVdnwNBT8HP7dx/0+i2qGph/Vos0SJBARgXW6h2Hf9wa3aQVYsSJc5LljcWukWps+ Ylx9rof1nwjACkh6vFIlhouvPdo5cCp2BTbOgR96jK49NNzzcYpOysTwUK1ukzMqtTMm XhOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GDtfbO4G; 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 u9-20020a654c09000000b003828506c119si11043370pgq.125.2022.04.19.06.46.11; Tue, 19 Apr 2022 06:46:27 -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=GDtfbO4G; 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 S243552AbiDRNl0 (ORCPT + 99 others); Mon, 18 Apr 2022 09:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242448AbiDRNJH (ORCPT ); Mon, 18 Apr 2022 09:09:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBD635A87; Mon, 18 Apr 2022 05:48:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id F3274B80D9C; Mon, 18 Apr 2022 12:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 356F5C385A7; Mon, 18 Apr 2022 12:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286111; bh=tS0bT0Ob+m2K2tG+sUf7Vtwmj0hwg1nLUyR2Yj1v28w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDtfbO4GleTsILMLNeV5CvhAhbGXthJvVa/Uq7M9iqDAR2UcVzH6ppORyKvE4a+rQ JfMHq946FQ3Qfo3oV7NOIKtCUcU+I/9VPYZyMpPnMlpNDIWUHuAWExLKlhKkTBHXR2 Rs8EUKjy63S2wDU/EjF4/U1IuPya+ZrZLebxPPy4= 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 4.14 031/284] scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands Date: Mon, 18 Apr 2022 14:10:12 +0200 Message-Id: <20220418121211.580662692@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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.7 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 @@ -220,7 +220,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)