soc: realview: Fix memory leak in realview_soc_probe()
PATCH 1/1 soc: realview: Fix memory leak in realview_soc_probe()
If of_property_read_string() failed, soc_dev_attr should be freed before return, otherwise the soc_dev_attr leaked.
Fixes a2974c9c1f83 ("soc: add driver for the ARM RealView")
Signed-off-by Yuan Can <[email protected]>
--- drivers/soc/versatile/soc-realview.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/versatile/soc-realview.c +3 -1
@@ -99,8 +99,10 @@ static int realview_soc_probe(struct platform_device *pdev) ret =of_property_read_string (np,"compatible" , &soc_dev_attr->soc_id); -if (ret) +if (ret) { +kfree (soc_dev_attr);return -EINVAL ; + } soc_dev_attr->machine ="RealView" ; soc_dev_attr->family ="Versatile" ;
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 5 lines · Yuan Can
If
of_property_read_string()failed,soc_dev_attrshould be freed before return, otherwise thesoc_dev_attrleaked.Fixes a2974c9c1f83 ("soc: add driver for the ARM RealView")Signed-off-by Yuan Can <[email protected]>
Hi Yuan,
thanks for your patch! I have applied it to my tree and I will send it upstream ASAP.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel