soc: qcom: rmtfs-mem: fix memleak in probe error paths
Subsystems (3)
PATCH 1/1 soc: qcom: rmtfs-mem: fix memleak in probe error paths
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 <[email protected]> # 4.15
Cc Bjorn Andersson <[email protected]>
Signed-off-by Johan Hovold <[email protected]>
--- drivers/soc/qcom/rmtfs_mem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/soc/qcom/rmtfs_mem.c +1 -2
@@ -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" );
Signature · 1 line
2.17.1
Quoted 8 lines · Johan Hovold
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 <[email protected]> # 4.15Cc Bjorn Andersson <[email protected]>Signed-off-by Johan Hovold <[email protected]>
I noticed that this one hasn't made it into linux-next yet, so sending a reminder.
Quoted 17 lines
--- drivers/soc/qcom/rmtfs_mem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/soc/qcom/rmtfs_mem.c +1
-0@@ -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 );
drivers/soc/qcom/rmtfs_mem.c static int qcom_rmtfs_mem_probe(struct platform_device *pdev) · line 212
Quoted 8 lines
drivers/soc/qcom/rmtfs_mem.c +0
-2@@ -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