提交 d913c743 编写于 作者: C Christian Engelmayer 提交者: Greg Kroah-Hartman

misc: genwqe: Fix potential memory leak when pinning memory

Fix a memory leak in the genwqe_pin_mem() error path as called by
ioctl GENWQE_PIN_MEM. In case there is an error encountered when
mapping memory, the already allocated dma_mapping struct needs to
be freed correctly.

Detected by Coverity: CID 1162606.
Signed-off-by: NChristian Engelmayer <cengelma@gmx.at>
Acked-by: NFrank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 d0f2a808
...@@ -787,6 +787,7 @@ static int genwqe_pin_mem(struct genwqe_file *cfile, struct genwqe_mem *m) ...@@ -787,6 +787,7 @@ static int genwqe_pin_mem(struct genwqe_file *cfile, struct genwqe_mem *m)
if (rc != 0) { if (rc != 0) {
dev_err(&pci_dev->dev, dev_err(&pci_dev->dev,
"[%s] genwqe_user_vmap rc=%d\n", __func__, rc); "[%s] genwqe_user_vmap rc=%d\n", __func__, rc);
kfree(dma_map);
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册