lkml.org 
[lkml]   [2019]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] misc: fastrpc: fix memory leak from miscdev->name
On Fri 13 Sep 08:25 PDT 2019, Jorge Ramirez-Ortiz wrote:

> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
> Fix a memory leak in miscdev->name by using devm_variant
>
> Orignally reported by kmemleak:
> [<ffffff80088b74d8>] kmemleak_alloc+0x50/0x84
> [<ffffff80081e015c>] __kmalloc_track_caller+0xe8/0x168
> [<ffffff8008371ab0>] kvasprintf+0x78/0x100
> [<ffffff8008371c6c>] kasprintf+0x50/0x74
> [<ffffff8008507f2c>] fastrpc_rpmsg_probe+0xd8/0x20c
> [<ffffff80086b63b4>] rpmsg_dev_probe+0xa8/0x148
> [<ffffff80084de50c>] really_probe+0x208/0x248
> [<ffffff80084de2dc>] driver_probe_device+0x98/0xc0
> [<ffffff80084dec6c>] __device_attach_driver+0x9c/0xac
> [<ffffff80084dca8c>] bus_for_each_drv+0x60/0x8c
> [<ffffff80084de64c>] __device_attach+0x8c/0x100
> [<ffffff80084de6e0>] device_initial_probe+0x20/0x28
> [<ffffff80084dcbd0>] bus_probe_device+0x34/0x7c
> [<ffffff80084da32c>] device_add+0x420/0x498
> [<ffffff80084da680>] device_register+0x24/0x2c
>

Cc: stable@vger.kernel.org
Fixes: f6f9279f2bf0 ("misc: fastrpc: Add Qualcomm fastrpc basic driver model")

> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

You should append your S-o-b here, as you forwarded the patch.


Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
> drivers/misc/fastrpc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 8903388993d3..bc03500bfe60 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1599,8 +1599,8 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
> }
>
> data->miscdev.minor = MISC_DYNAMIC_MINOR;
> - data->miscdev.name = kasprintf(GFP_KERNEL, "fastrpc-%s",
> - domains[domain_id]);
> + data->miscdev.name = devm_kasprintf(rdev, GFP_KERNEL, "fastrpc-%s",
> + domains[domain_id]);
> data->miscdev.fops = &fastrpc_fops;
> err = misc_register(&data->miscdev);
> if (err)
> --
> 2.23.0
>

\
 
 \ /
  Last update: 2019-09-18 08:34    [W:0.071 / U:3.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site