Commit 2a6a20ea authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Martin K. Petersen

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: default avatarJohannes Thumshirn <>
Acked-by: default avatarNarsimhulu Musini <>
Reviewed-by: default avatarLaurence Oberman <>
Signed-off-by: default avatarMartin K. Petersen <>
parent 40e4c0a4
......@@ -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)) {
snic_req_free(snic, rqi);
"Rpt-tgt rspbuf %p: PCI DMA Mapping Failed\n",
snic_req_free(snic, rqi);
ret = -EINVAL;
goto error;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment