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

[SCSI] 3w-9xxx: fix iommu_iova leak

Following reports on the list, it looks like the 3e-9xxx driver will leak dma
mappings every time we get a transient queueing error back from the card.
This is because it maps the sg list in the routine that sends the command, but
doesn't unmap again in the transient failure path (even though the command is
sent back to the block layer). Fix by unmapping before returning the status.

Reported-by: Chris Boot <bootc@bootc.net>
Tested-by: Chris Boot <bootc@bootc.net>
Acked-by: Adam Radford <aradford@gmail.com>
Cc: stable@kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

+2
+2
drivers/scsi/3w-9xxx.c
··· 1800 1800 switch (retval) { 1801 1801 case SCSI_MLQUEUE_HOST_BUSY: 1802 1802 twa_free_request_id(tw_dev, request_id); 1803 + twa_unmap_scsi_data(tw_dev, request_id); 1803 1804 break; 1804 1805 case 1: 1805 1806 tw_dev->state[request_id] = TW_S_COMPLETED; 1806 1807 twa_free_request_id(tw_dev, request_id); 1808 + twa_unmap_scsi_data(tw_dev, request_id); 1807 1809 SCpnt->result = (DID_ERROR << 16); 1808 1810 done(SCpnt); 1809 1811 retval = 0;