From: Christian Engelmayer Date: Sat, 25 Jan 2014 21:47:44 +0000 (+0100) Subject: misc: genwqe: Fix potential memory leak when pinning memory X-Git-Tag: firefly_0821_release~176^2~4420^2~5 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d913c7439add288b50752186b306634df2ae21e7;p=firefly-linux-kernel-4.4.55.git 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: Christian Engelmayer Acked-by: Frank Haverkamp Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 8f8a6b327cdb..2c2c9cc75231 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -787,6 +787,7 @@ static int genwqe_pin_mem(struct genwqe_file *cfile, struct genwqe_mem *m) if (rc != 0) { dev_err(&pci_dev->dev, "[%s] genwqe_user_vmap rc=%d\n", __func__, rc); + kfree(dma_map); return rc; }