diff mbox

soc: qcom: rmtfs-mem: fix memleak in probe error paths

Message ID 20180612124141.6307-1-johan@kernel.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Johan Hovold June 12, 2018, 12:41 p.m. UTC
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(-)

Comments

Johan Hovold July 6, 2018, 12:06 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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");