Skip to contentSkip to conversation

misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach

PATCH New Navid Emamdoost 1 participant 1 message Sep 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/misc/fastrpc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/fastrpc.c +1 -0
index 47ae84afac2e..1b1a794d639d 100644
@@ -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;
 	}
 
Signature · 1 line
2.17.1