]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sun, 20 Feb 2022 03:17:40 +0000 (12:17 +0900)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 13:18:22 +0000 (15:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1971497
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 <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/scsi/libsas/sas_ata.c

index 5d28bb7f2ca40d7b514ae87772e6be5ac56c6628..5c801705c4700f39580c57761dafc29b378c0f7a 100644 (file)
@@ -201,7 +201,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
                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)