Skip to content

Commit 6158e34

Browse files
committed
ata: libata-core: improve tag checks in ata_qc_issue()
Make sure to check that the tag of a queued command is valid when ata_qc_issue() is called, and fail the QC if the tag is not valid, or if there is an on-going non-NCQ command already on the link. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de>
1 parent 6de23f8 commit 6158e34

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/ata/libata-core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5146,8 +5146,13 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
51465146
struct ata_link *link = qc->dev->link;
51475147
u8 prot = qc->tf.protocol;
51485148

5149-
/* Make sure only one non-NCQ command is outstanding. */
5150-
WARN_ON_ONCE(ata_tag_valid(link->active_tag));
5149+
/*
5150+
* Make sure we have a valid tag and that only one non-NCQ command is
5151+
* outstanding.
5152+
*/
5153+
if (WARN_ON_ONCE(!ata_tag_valid(qc->tag)) ||
5154+
WARN_ON_ONCE(ata_tag_valid(link->active_tag)))
5155+
goto sys_err;
51515156

51525157
if (ata_is_ncq(prot)) {
51535158
WARN_ON_ONCE(link->sactive & (1 << qc->hw_tag));

0 commit comments

Comments
 (0)