[PATCH] libata: fix ata_qc_issue() error handling
When ata_qc_issue() fails, the qc might have been dma mapped or not. So, performing only ata_qc_free() results in dma map leak. This patch makes ata_qc_issue() mark dma map flags correctly on failure and calls ata_qc_complete() after ata_qc_issue() fails. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
@@ -1322,8 +1322,10 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
|
||||
goto early_finish;
|
||||
|
||||
/* select device, send command to hardware */
|
||||
if (ata_qc_issue(qc))
|
||||
goto err_did;
|
||||
if (ata_qc_issue(qc)) {
|
||||
qc->err_mask |= AC_ERR_OTHER;
|
||||
ata_qc_complete(qc);
|
||||
}
|
||||
|
||||
VPRINTK("EXIT\n");
|
||||
return;
|
||||
|
Reference in New Issue
Block a user