[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200512005725.GA57962@builder.lan>
Date: Mon, 11 May 2020 17:57:25 -0700
From: Bjorn Andersson <bjorn.andersson@...aro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: gregkh@...uxfoundation.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, arnd@...db.de
Subject: Re: [PATCH v2] misc: fastrpc: Fix an incomplete memory release in
fastrpc_rpmsg_probe()
On Mon 11 May 09:27 PDT 2020, Srinivas Kandagatla wrote:
> fastrpc_channel_ctx is not freed if misc_register() fails, this would
> lead to a memory leak. Fix this leak by adding kfree in misc_register()
> error path.
>
> Fixes: 278d56f970ae ("misc: fastrpc: Reference count channel context")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> ---
> Changes since v1:
> - Update subject as suggested
> - added fixes tag
>
> drivers/misc/fastrpc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index c562e285e0f4..07065728e39f 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1615,8 +1615,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
> domains[domain_id]);
> data->miscdev.fops = &fastrpc_fops;
> err = misc_register(&data->miscdev);
> - if (err)
> + if (err) {
> + kfree(data);
> return err;
> + }
>
> kref_init(&data->refcount);
>
> --
> 2.21.0
>
Powered by blists - more mailing lists