提交 2a6a20ea 编写于 作者: J Johannes Thumshirn 提交者: 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: NJohannes Thumshirn <jthumshirn@suse.de>
Acked-by: NNarsimhulu Musini <nmusini@cisco.com>
Reviewed-by: NLaurence Oberman <loberman@redhat.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 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)) {
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册