Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: gregkh@linuxfoundation.org, arnd@arndb.de,
	srinivas.kandagatla@linaro.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/5] misc: fastrpc: fix memory leak from miscdev->name
Date: Tue, 17 Sep 2019 23:34:03 -0700
Message-ID: <20190918063403.GD1636@tuxbook-pro> (raw)
In-Reply-To: <20190913152532.24484-3-jorge.ramirez-ortiz@linaro.org>

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
> 

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 15:25 [PATCH 0/5] misc: fastrpc: fixes and map/unmap support Jorge Ramirez-Ortiz
2019-09-13 15:25 ` [PATCH 1/5] misc: fastrpc: add mmap/unmap support Jorge Ramirez-Ortiz
2019-09-13 15:25 ` [PATCH 2/5] misc: fastrpc: fix memory leak from miscdev->name Jorge Ramirez-Ortiz
2019-09-18  6:34   ` Bjorn Andersson [this message]
2019-09-13 15:25 ` [PATCH 3/5] misc: fastrpc: do not interrupt kernel calls Jorge Ramirez-Ortiz
2019-09-13 15:25 ` [PATCH 4/5] misc: fastrpc: handle interrupted contexts Jorge Ramirez-Ortiz
2019-09-13 15:25 ` [PATCH 5/5] misc: fastrpc: revert max init file size back to 2MB Jorge Ramirez-Ortiz

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190918063403.GD1636@tuxbook-pro \
    --to=bjorn.andersson@linaro.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jorge.ramirez-ortiz@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org linux-arm-msm@archiver.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox