]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ata: libata-scsi: Return aborted command when missing sense and result TF
authorDamien Le Moal <dlemoal@kernel.org>
Tue, 29 Jul 2025 10:37:12 +0000 (19:37 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:34:17 +0000 (16:34 +0200)
commit369144743de102762679463326475d1777341698
tree2d746d6d610f696b5a2ec0988ace99e6aaac5d7c
parent979f38605b7fbad9ee1be43029e107fe5610f7bd
ata: libata-scsi: Return aborted command when missing sense and result TF

commit d2be9ea9a75550a35c5127a6c2633658bc38c76b upstream.

ata_gen_ata_sense() is always called for a failed qc missing sense data
so that a sense key, code and code qualifier can be generated using
ata_to_sense_error() from the qc status and error fields of its result
task file. However, if the qc does not have its result task file filled,
ata_gen_ata_sense() returns early without setting a sense key.

Improve this by defaulting to returning ABORTED COMMAND without any
additional sense code, since we do not know the reason for the failure.
The same fix is also applied in ata_gen_passthru_sense() with the
additional check that the qc failed (qc->err_mask is set).

Fixes: 816be86c7993 ("ata: libata-scsi: Check ATA_QCFLAG_RTF_FILLED before using result_tf")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/libata-scsi.c