[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR07MB34211A06B97DCA4B4FB387C2A24F0@VI1PR07MB3421.eurprd07.prod.outlook.com>
Date: Mon, 16 Oct 2017 02:29:17 +0000
From: "Wang, Alan 1. (NSB - CN/Hangzhou)" <alan.1.wang@...ia-sbell.com>
To: Frank Rowand <frowand.list@...il.com>,
Pantelis Antoniou <pantelis.antoniou@...sulko.com>,
Rob Herring <robh+dt@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: RE: [PATCH 1/2] of: overlay: fix memory leak related to duplicated
property
Hi Frank,
This only has one patch, and I was sent out this by mistake. Please skip this one and refer to my following subject "[PATCH] of: overlay: fix memory leak related to duplicated property"
https://lkml.org/lkml/2017/10/12/952
Thanks
-----Original Message-----
From: Frank Rowand [mailto:frowand.list@...il.com]
Sent: Saturday, October 14, 2017 5:39 AM
To: Wang, Alan 1. (NSB - CN/Hangzhou) <alan.1.wang@...ia-sbell.com>; Pantelis Antoniou <pantelis.antoniou@...sulko.com>; Rob Herring <robh+dt@...nel.org>
Cc: linux-kernel@...r.kernel.org; devicetree@...r.kernel.org
Subject: Re: [PATCH 1/2] of: overlay: fix memory leak related to duplicated property
On 10/12/17 18:53, alawang wrote:
> Function of_changeset_add_property or of_changeset_update_property may
> fails. In this case the property just allocated is never deallocated.
>
> Signed-off-by: alawang <alan.1.wang@...ia-sbell.com>
> ---
> drivers/of/overlay.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index
> 8ecfee3..af3b9a1 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -162,6 +162,7 @@ static int of_overlay_apply_single_property(struct of_overlay *ov,
> bool is_symbols_node)
> {
> struct property *propn = NULL, *tprop;
> + int ret = 0;
>
> /* NOTE: Multiple changes of single properties not supported */
> tprop = of_find_property(target, prop->name, NULL); @@ -186,10
> +187,16 @@ static int of_overlay_apply_single_property(struct
> of_overlay *ov,
>
> /* not found? add */
> if (tprop == NULL)
> - return of_changeset_add_property(&ov->cset, target, propn);
> -
> - /* found? update */
> - return of_changeset_update_property(&ov->cset, target, propn);
> + ret = of_changeset_add_property(&ov->cset, target, propn);
> + else /* found? update */
> + ret = of_changeset_update_property(&ov->cset, target, propn);
> +
> + if (ret) {
> + kfree(propn->name);
> + kfree(propn->value);
> + kfree(propn);
> + }
> + return ret;
> }
>
> static int of_overlay_apply_single_device_node(struct of_overlay *ov,
>
I only received patch 1/2. Can you please re-send patch 2/2?
Thanks,
Frank
Powered by blists - more mailing lists