stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: rmtfs-mem: fix memleak in probe error paths
@ 2018-06-12 12:41 Johan Hovold
  2018-07-06 12:06 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2018-06-12 12:41 UTC (permalink / raw)
  To: Andy Gross
  Cc: David Brown, linux-arm-msm, linux-soc, linux-kernel, Johan Hovold,
	stable, Bjorn Andersson

Make sure to set the mem device release callback before calling
put_device() in a couple of probe error paths so that the containing
object also gets freed.

Fixes: d1de6d6c639b ("soc: qcom: Remote filesystem memory driver")
Cc: stable <stable@vger.kernel.org>     # 4.15
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/soc/qcom/rmtfs_mem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
index c8999e38b005..8a3678c2e83c 100644
--- a/drivers/soc/qcom/rmtfs_mem.c
+++ b/drivers/soc/qcom/rmtfs_mem.c
@@ -184,6 +184,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
 	device_initialize(&rmtfs_mem->dev);
 	rmtfs_mem->dev.parent = &pdev->dev;
 	rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups;
+	rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
 
 	rmtfs_mem->base = devm_memremap(&rmtfs_mem->dev, rmtfs_mem->addr,
 					rmtfs_mem->size, MEMREMAP_WC);
@@ -206,8 +207,6 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
 		goto put_device;
 	}
 
-	rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
-
 	ret = of_property_read_u32(node, "qcom,vmid", &vmid);
 	if (ret < 0 && ret != -EINVAL) {
 		dev_err(&pdev->dev, "failed to parse qcom,vmid\n");
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] soc: qcom: rmtfs-mem: fix memleak in probe error paths
  2018-06-12 12:41 [PATCH] soc: qcom: rmtfs-mem: fix memleak in probe error paths Johan Hovold
@ 2018-07-06 12:06 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2018-07-06 12:06 UTC (permalink / raw)
  To: Andy Gross
  Cc: David Brown, linux-arm-msm, linux-soc, linux-kernel, Johan Hovold,
	stable, Bjorn Andersson

On Tue, Jun 12, 2018 at 02:41:41PM +0200, Johan Hovold wrote:
> Make sure to set the mem device release callback before calling
> put_device() in a couple of probe error paths so that the containing
> object also gets freed.
> 
> Fixes: d1de6d6c639b ("soc: qcom: Remote filesystem memory driver")
> Cc: stable <stable@vger.kernel.org>     # 4.15
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>

I noticed that this one hasn't made it into linux-next yet, so sending a
reminder.

> ---
>  drivers/soc/qcom/rmtfs_mem.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
> index c8999e38b005..8a3678c2e83c 100644
> --- a/drivers/soc/qcom/rmtfs_mem.c
> +++ b/drivers/soc/qcom/rmtfs_mem.c
> @@ -184,6 +184,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
>  	device_initialize(&rmtfs_mem->dev);
>  	rmtfs_mem->dev.parent = &pdev->dev;
>  	rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups;
> +	rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
>  
>  	rmtfs_mem->base = devm_memremap(&rmtfs_mem->dev, rmtfs_mem->addr,
>  					rmtfs_mem->size, MEMREMAP_WC);
> @@ -206,8 +207,6 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
>  		goto put_device;
>  	}
>  
> -	rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
> -
>  	ret = of_property_read_u32(node, "qcom,vmid", &vmid);
>  	if (ret < 0 && ret != -EINVAL) {
>  		dev_err(&pdev->dev, "failed to parse qcom,vmid\n");

Thanks,
Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-06 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12 12:41 [PATCH] soc: qcom: rmtfs-mem: fix memleak in probe error paths Johan Hovold
2018-07-06 12:06 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).