Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3140163pxb; Mon, 18 Apr 2022 17:04:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC1NzgGqG2I5ro8Rm6qaZ7h2s32Nv1TTaxwVAMC5tJFUr0ogMuhGOGScdvto3Dp1F76eKi X-Received: by 2002:a63:f341:0:b0:39d:3ce2:fc8d with SMTP id t1-20020a63f341000000b0039d3ce2fc8dmr11911590pgj.441.1650326664298; Mon, 18 Apr 2022 17:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650326664; cv=none; d=google.com; s=arc-20160816; b=QWJ8u/odCna3UwlWV+0mqbSE/bKcWjY82LlXfYIA8j9Key2emaq/QgZpRnpoVInT8+ EwNAA/d6VS8+GklCQbQa8uA48a5agbVtfOfKtVhQ71YWczdFitTSI54ltP+6o8l/2wuO Bl1ETi+AkoV4BasPzIXeSRn2ofcU4vaf7+83BHdCAAug2+hDO9QwixQkaDNxyPIw76JV oRFJPH2ZiShlKF/txAjwjH6dixAnQP1RjKOQRTzBiQsIQiHofXQLNaoj9UXrHCCnX01Q tCRjzrpar2bcTirzExhWMFuQv8tQwN9kYEHbGZ8VpU2dWOFf3EsEANcFFPg/IrdnS/DS vSdQ== 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=Ux6VAzKW0GqkFbb+agtgnQIflLnIvKRnKH8evLrF7Uk8RkhH0A8Ueg0ZcSwAszs7Qj xBcfh5PvacBMq8NZu5jOttjvaf98zCN5bLFXnYRHZuoXtzchm7I37Oxh81j1vgi926es D5+KyW6JTjX9sCKvodtHw882Y4prF8LGpZm1gaxtIcGMrPspvRIWrX4ei53rSXUT2kdD uLApevSPVqwW4nhCllKbGtTt7RR2VdnaX3dlz7qSBEJTrN8r6ot3wFLrsuyazJOqUzgb BstGv8UKESvonSj6RRSDqlFwRDw1Qb2sERxdgzob5MkzhP7fybWANtv6ZfDrSaKMwGfm K5dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YjEoRNEZ; 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 b30-20020a631b1e000000b003992ad63332si10492395pgb.404.2022.04.18.17.04.08; Mon, 18 Apr 2022 17:04:24 -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=YjEoRNEZ; 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 S245101AbiDROLH (ORCPT + 99 others); Mon, 18 Apr 2022 10:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245723AbiDRNx7 (ORCPT ); Mon, 18 Apr 2022 09:53:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0584706A; Mon, 18 Apr 2022 06:03:08 -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 25F4D60B35; Mon, 18 Apr 2022 13:03:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18EA4C385A7; Mon, 18 Apr 2022 13:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286987; bh=tS0bT0Ob+m2K2tG+sUf7Vtwmj0hwg1nLUyR2Yj1v28w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YjEoRNEZpPbo34YDYmVxQuKpXFmTG8ZUAMRjuzrtj36wPxUYUc/8Ll+OiKIbUJaNF 6gZnOiFoZwAI9ELfmQFCDSXqnltlOnd4Ow280w9SmpKsg+cChQrFrmvVND60lIElbj DYGoNQ/NE5nYN5IuyyTlpm4T6OL9I7dsOaryewTw= 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.9 023/218] scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands Date: Mon, 18 Apr 2022 14:11:29 +0200 Message-Id: <20220418121159.899603887@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121158.636999985@linuxfoundation.org> References: <20220418121158.636999985@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)