summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-09-25 17:27:41 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-04 18:22:14 +0200
commitfc739a058d99c9297ef6bfd923b809d85855b9a9 (patch)
tree597aac8213b123a80d699b0c598fe5ac63ef4036 /drivers/misc
parentmei: avoid FW version request on Ibex Peak and earlier (diff)
downloadlinux-fc739a058d99c9297ef6bfd923b809d85855b9a9.tar.xz
linux-fc739a058d99c9297ef6bfd923b809d85855b9a9.zip
misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach
In fastrpc_dma_buf_attach if dma_get_sgtable fails the allocated memory for a should be released. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Link: https://lore.kernel.org/r/20190925152742.16258-1-navid.emamdoost@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/fastrpc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 47ae84afac2e..1b1a794d639d 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -527,6 +527,7 @@ static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf,
FASTRPC_PHYS(buffer->phys), buffer->size);
if (ret < 0) {
dev_err(buffer->dev, "failed to get scatterlist from DMA API\n");
+ kfree(a);
return -EINVAL;
}