libata: be less of a drama queen on empty data commands
ata_qc_issue() BUG_ON()s on data commands w/o data, which may be submitted via SG_IO. Be less of a drama queen and just trigger WARN_ON_ONCE() and fail the command with AC_ERR_SYSTEM. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Stefan Hübner <stefan.huebner@stud.tu-ilmenau.de> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
@@ -5111,15 +5111,18 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
|
|||||||
qc->flags |= ATA_QCFLAG_ACTIVE;
|
qc->flags |= ATA_QCFLAG_ACTIVE;
|
||||||
ap->qc_active |= 1 << qc->tag;
|
ap->qc_active |= 1 << qc->tag;
|
||||||
|
|
||||||
/* We guarantee to LLDs that they will have at least one
|
/*
|
||||||
|
* We guarantee to LLDs that they will have at least one
|
||||||
* non-zero sg if the command is a data command.
|
* non-zero sg if the command is a data command.
|
||||||
*/
|
*/
|
||||||
BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes));
|
if (WARN_ON_ONCE(ata_is_data(prot) &&
|
||||||
|
(!qc->sg || !qc->n_elem || !qc->nbytes)))
|
||||||
|
goto sys_err;
|
||||||
|
|
||||||
if (ata_is_dma(prot) || (ata_is_pio(prot) &&
|
if (ata_is_dma(prot) || (ata_is_pio(prot) &&
|
||||||
(ap->flags & ATA_FLAG_PIO_DMA)))
|
(ap->flags & ATA_FLAG_PIO_DMA)))
|
||||||
if (ata_sg_setup(qc))
|
if (ata_sg_setup(qc))
|
||||||
goto sg_err;
|
goto sys_err;
|
||||||
|
|
||||||
/* if device is sleeping, schedule reset and abort the link */
|
/* if device is sleeping, schedule reset and abort the link */
|
||||||
if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
|
if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
|
||||||
@@ -5136,7 +5139,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
|
|||||||
goto err;
|
goto err;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sg_err:
|
sys_err:
|
||||||
qc->err_mask |= AC_ERR_SYSTEM;
|
qc->err_mask |= AC_ERR_SYSTEM;
|
||||||
err:
|
err:
|
||||||
ata_qc_complete(qc);
|
ata_qc_complete(qc);
|
||||||
|
Reference in New Issue
Block a user