Skip to content

Commit 3ac873c

Browse files
Niklas Casseldamien-lemoal
authored andcommitted
ata: libata-core: fix when to fetch sense data for successful commands
The condition to fetch sense data was supposed to be: ATA_SENSE set AND either 1) Command was NCQ and ATA_DFLAG_CDL_ENABLED flag set (flag ATA_DFLAG_CDL_ENABLED will only be set if the Successful NCQ command sense data supported bit is set); or 2) Command was non-NCQ and regular sense data reporting is enabled. However the check in 2) accidentally had the negation at the wrong place, causing it to try to fetch sense data if it was a non-NCQ command _or_ if regular sense data reporting was _not_ enabled. Fix this by removing the extra parentheses that should not be there, such that only the correct return (ata_is_ncq()) is negated. Fixes: 18bd771 ("scsi: ata: libata: Handle completion of CDL commands using policy 0xD") Reported-by: Borislav Petkov <[email protected]> Closes: https://lore.kernel.org/linux-ide/20230722155621.GIZLv8JbURKzHtKvQE@fat_crate.local/ Signed-off-by: Niklas Cassel <[email protected]> Tested-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Jason Yan <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 3fc2feb commit 3ac873c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/ata/libata-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4938,8 +4938,8 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
49384938
if (qc->result_tf.status & ATA_SENSE &&
49394939
((ata_is_ncq(qc->tf.protocol) &&
49404940
dev->flags & ATA_DFLAG_CDL_ENABLED) ||
4941-
(!(ata_is_ncq(qc->tf.protocol) &&
4942-
ata_id_sense_reporting_enabled(dev->id))))) {
4941+
(!ata_is_ncq(qc->tf.protocol) &&
4942+
ata_id_sense_reporting_enabled(dev->id)))) {
49434943
/*
49444944
* Tell SCSI EH to not overwrite scmd->result even if
49454945
* this command is finished with result SAM_STAT_GOOD.

0 commit comments

Comments
 (0)