diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-06-23 14:37:20 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-07-12 23:16:31 -0400 |
commit | 2a6a20ea7d894464ca6bd402058c1aadf796a48c (patch) | |
tree | 149a1250c52c19c843c9651413a94f6de53fa9aa /drivers/scsi/snic | |
parent | 40e4c0a4e1d5414ed33e5bc846a832dc868fa65d (diff) | |
download | talos-op-linux-2a6a20ea7d894464ca6bd402058c1aadf796a48c.tar.gz talos-op-linux-2a6a20ea7d894464ca6bd402058c1aadf796a48c.zip |
snic: Fix use-after-free in case of a dma mapping error
If there is a dma mapping error snic kfree()s buf right before printing
it. Change the order to not accidently trip on memory that's not owned
by us anymore.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Narsimhulu Musini <nmusini@cisco.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/snic')
-rw-r--r-- | drivers/scsi/snic/snic_disc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c index b0fefd67cac3..b106596cc0cf 100644 --- a/drivers/scsi/snic/snic_disc.c +++ b/drivers/scsi/snic/snic_disc.c @@ -113,11 +113,11 @@ snic_queue_report_tgt_req(struct snic *snic) pa = pci_map_single(snic->pdev, buf, buf_len, PCI_DMA_FROMDEVICE); if (pci_dma_mapping_error(snic->pdev, pa)) { - kfree(buf); - snic_req_free(snic, rqi); SNIC_HOST_ERR(snic->shost, "Rpt-tgt rspbuf %p: PCI DMA Mapping Failed\n", buf); + kfree(buf); + snic_req_free(snic, rqi); ret = -EINVAL; goto error; |