Message ID | 20190829092926.12037-6-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Commit | cf61860e6b090bea4050c5688566bfe357cacd11 |
Headers | show |
Series | misc: fastrpc: few fixes | expand |
Quoting Srinivas Kandagatla (2019-08-29 02:29:26) > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index eee2bb398947..47ae84afac2e 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -550,6 +550,7 @@ static void fastrpc_dma_buf_detatch(struct dma_buf *dmabuf, Is the function really called buf_detatch? Is it supposed to be buf_detach? > mutex_lock(&buffer->lock); > list_del(&a->node); > mutex_unlock(&buffer->lock); > + sg_free_table(&a->sgt); > kfree(a);
On 05/09/2019 06:11, Stephen Boyd wrote: > Quoting Srinivas Kandagatla (2019-08-29 02:29:26) >> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c >> index eee2bb398947..47ae84afac2e 100644 >> --- a/drivers/misc/fastrpc.c >> +++ b/drivers/misc/fastrpc.c >> @@ -550,6 +550,7 @@ static void fastrpc_dma_buf_detatch(struct dma_buf *dmabuf, > > Is the function really called buf_detatch? Is it supposed to be > buf_detach? Thanks Stephen, for you keen observation on the spelling, I will send a patch to fix that! Looks like I inherited that from drivers/staging/android/ion/ion.c --srini > >> mutex_lock(&buffer->lock); >> list_del(&a->node); >> mutex_unlock(&buffer->lock); >> + sg_free_table(&a->sgt); >> kfree(a);
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index eee2bb398947..47ae84afac2e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -550,6 +550,7 @@ static void fastrpc_dma_buf_detatch(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); list_del(&a->node); mutex_unlock(&buffer->lock); + sg_free_table(&a->sgt); kfree(a); }
dma buf scatter list is never freed, free it! Orignally detected by kmemleak: backtrace: [<ffffff80088b7658>] kmemleak_alloc+0x50/0x84 [<ffffff8008373284>] sg_kmalloc+0x38/0x60 [<ffffff8008373144>] __sg_alloc_table+0x60/0x110 [<ffffff800837321c>] sg_alloc_table+0x28/0x58 [<ffffff800837336c>] __sg_alloc_table_from_pages+0xc0/0x1ac [<ffffff800837346c>] sg_alloc_table_from_pages+0x14/0x1c [<ffffff8008097a3c>] __iommu_get_sgtable+0x5c/0x8c [<ffffff800850a1d0>] fastrpc_dma_buf_attach+0x84/0xf8 [<ffffff80085114bc>] dma_buf_attach+0x70/0xc8 [<ffffff8008509efc>] fastrpc_map_create+0xf8/0x1e8 [<ffffff80085086f4>] fastrpc_device_ioctl+0x508/0x900 [<ffffff80082428c8>] compat_SyS_ioctl+0x128/0x200 [<ffffff80080832c4>] el0_svc_naked+0x34/0x38 [<ffffffffffffffff>] 0xffffffffffffffff Reported-by: Mayank Chopra <mak.chopra@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- drivers/misc/fastrpc.c | 1 + 1 file changed, 1 insertion(+)