| From 6e5539a37bebc68ec6dcd228778b6a7ce95b7461 Mon Sep 17 00:00:00 2001 |
| From: Navid Emamdoost <navid.emamdoost@gmail.com> |
| Date: Wed, 25 Sep 2019 10:27:41 -0500 |
| Subject: [PATCH] misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach |
| |
| commit fc739a058d99c9297ef6bfd923b809d85855b9a9 upstream. |
| |
| 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> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
| index 98603e235cf0..a76b6c6fd660 100644 |
| --- a/drivers/misc/fastrpc.c |
| +++ b/drivers/misc/fastrpc.c |
| @@ -499,6 +499,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; |
| } |
| |
| -- |
| 2.7.4 |
| |