Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+7 -2
+7 -2
drivers/ata/libata-core.c
··· 5146 5146 struct ata_link *link = qc->dev->link; 5147 5147 u8 prot = qc->tf.protocol; 5148 5148 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; 5151 5156 5152 5157 if (ata_is_ncq(prot)) { 5153 5158 WARN_ON_ONCE(link->sactive & (1 << qc->hw_tag));