* [PATCH 1/2] of: overlay: fix memory leak related to duplicated property @ 2017-10-13 1:53 alawang 2017-10-13 3:07 ` [PATCH] " Lixin Wang 2017-10-13 21:39 ` [PATCH 1/2] " Frank Rowand 0 siblings, 2 replies; 11+ messages in thread From: alawang @ 2017-10-13 1:53 UTC (permalink / raw) To: Pantelis Antoniou, Rob Herring, Frank Rowand Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, alawang 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-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> --- 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, -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] of: overlay: fix memory leak related to duplicated property 2017-10-13 1:53 [PATCH 1/2] of: overlay: fix memory leak related to duplicated property alawang @ 2017-10-13 3:07 ` Lixin Wang [not found] ` <1507864056-52089-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> 2017-10-16 9:54 ` Lixin Wang 2017-10-13 21:39 ` [PATCH 1/2] " Frank Rowand 1 sibling, 2 replies; 11+ messages in thread From: Lixin Wang @ 2017-10-13 3:07 UTC (permalink / raw) To: Pantelis Antoniou, Rob Herring, Frank Rowand Cc: linux-kernel, devicetree, alawang From: alawang <alan.1.wang@nokia-sbell.com> Hello, Sorry It was my fault in last email that wrote the wrong subject and sign off name. Correct them this time. Thanks 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: Lixin Wang <alan.1.wang@nokia-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, -- 2.6.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1507864056-52089-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org>]
* Re: [PATCH] of: overlay: fix memory leak related to duplicated property [not found] ` <1507864056-52089-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> @ 2017-10-13 20:49 ` Rob Herring 2017-10-13 22:04 ` Frank Rowand 1 sibling, 0 replies; 11+ messages in thread From: Rob Herring @ 2017-10-13 20:49 UTC (permalink / raw) To: Lixin Wang Cc: Pantelis Antoniou, Frank Rowand, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Thu, Oct 12, 2017 at 10:07 PM, Lixin Wang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> wrote: > From: alawang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> > > Hello, > > Sorry It was my fault in last email that wrote the wrong subject and sign off name. > Correct them this time. > Thanks This has to go below the '---' or it ends up in the commit message. Please resend. > > 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: Lixin Wang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> > --- > 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, > -- > 2.6.2 > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] of: overlay: fix memory leak related to duplicated property [not found] ` <1507864056-52089-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> 2017-10-13 20:49 ` Rob Herring @ 2017-10-13 22:04 ` Frank Rowand 2017-10-16 2:35 ` Wang, Alan 1. (NSB - CN/Hangzhou) 1 sibling, 1 reply; 11+ messages in thread From: Frank Rowand @ 2017-10-13 22:04 UTC (permalink / raw) To: Lixin Wang, Pantelis Antoniou, Rob Herring Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Hi Rob, On 10/12/17 20:07, Lixin Wang wrote: > From: alawang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> > > Hello, > > Sorry It was my fault in last email that wrote the wrong subject and sign off name. > Correct them this time. > Thanks > > 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: Lixin Wang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> > --- > 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, > Just a heads up. This will conflict with my patch series "[PATCH 00/12] of: overlay: clean up device tree overlay code" [1]. The issue that Lixin has identified will still remain after applying my patch series, and can be fixed in the same manner as his patch, just different context, including variable names. [1] https://lkml.org/lkml/2017/10/2/679 -Frank -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] of: overlay: fix memory leak related to duplicated property 2017-10-13 22:04 ` Frank Rowand @ 2017-10-16 2:35 ` Wang, Alan 1. (NSB - CN/Hangzhou) [not found] ` <VI1PR07MB342187128B48F66C464401A2A24F0-ErKcd1u/gBOORytiVngBPTzdlHkvsOLVvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Wang, Alan 1. (NSB - CN/Hangzhou) @ 2017-10-16 2:35 UTC (permalink / raw) To: Frank Rowand, Pantelis Antoniou, Rob Herring Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Hi Frank, Could I continue to send my patch since conflict with your patches? Or I have to wait for your patches merged? Thanks. -----Original Message----- From: Frank Rowand [mailto:frowand.list@gmail.com] Sent: Saturday, October 14, 2017 6:05 AM To: Wang, Alan 1. (NSB - CN/Hangzhou) <alan.1.wang@nokia-sbell.com>; Pantelis Antoniou <pantelis.antoniou@konsulko.com>; Rob Herring <robh+dt@kernel.org> Cc: linux-kernel@vger.kernel.org; devicetree@vger.kernel.org Subject: Re: [PATCH] of: overlay: fix memory leak related to duplicated property Hi Rob, On 10/12/17 20:07, Lixin Wang wrote: > From: alawang <alan.1.wang@nokia-sbell.com> > > Hello, > > Sorry It was my fault in last email that wrote the wrong subject and sign off name. > Correct them this time. > Thanks > > 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: Lixin Wang <alan.1.wang@nokia-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, > Just a heads up. This will conflict with my patch series "[PATCH 00/12] of: overlay: clean up device tree overlay code" [1]. The issue that Lixin has identified will still remain after applying my patch series, and can be fixed in the same manner as his patch, just different context, including variable names. [1] https://lkml.org/lkml/2017/10/2/679 -Frank ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <VI1PR07MB342187128B48F66C464401A2A24F0-ErKcd1u/gBOORytiVngBPTzdlHkvsOLVvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* Re: [PATCH] of: overlay: fix memory leak related to duplicated property [not found] ` <VI1PR07MB342187128B48F66C464401A2A24F0-ErKcd1u/gBOORytiVngBPTzdlHkvsOLVvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> @ 2017-10-16 6:07 ` Frank Rowand 2017-10-16 20:54 ` Rob Herring 0 siblings, 1 reply; 11+ messages in thread From: Frank Rowand @ 2017-10-16 6:07 UTC (permalink / raw) To: Wang, Alan 1. (NSB - CN/Hangzhou), Pantelis Antoniou, Rob Herring Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi Alan, It is Rob's choice of which order to take the patches in. Either order, it will be a trivial fixup to the second patchset to go in. -Frank On 10/15/17 19:35, Wang, Alan 1. (NSB - CN/Hangzhou) wrote: > Hi Frank, > > Could I continue to send my patch since conflict with your patches? Or I have to wait for your patches merged? Thanks. > > -----Original Message----- > From: Frank Rowand [mailto:frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] > Sent: Saturday, October 14, 2017 6:05 AM > To: Wang, Alan 1. (NSB - CN/Hangzhou) <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org>; Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>; Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Subject: Re: [PATCH] of: overlay: fix memory leak related to duplicated property > > Hi Rob, > > On 10/12/17 20:07, Lixin Wang wrote: >> From: alawang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> >> >> Hello, >> >> Sorry It was my fault in last email that wrote the wrong subject and sign off name. >> Correct them this time. >> Thanks >> >> 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: Lixin Wang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> >> --- >> 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, >> > > Just a heads up. > > This will conflict with my patch series "[PATCH 00/12] of: overlay: clean up device tree overlay code" [1]. The issue that Lixin has identified will still remain after applying my patch series, and can be fixed in the same manner as his patch, just different context, including variable names. > > [1] https://lkml.org/lkml/2017/10/2/679 > > -Frank > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] of: overlay: fix memory leak related to duplicated property 2017-10-16 6:07 ` Frank Rowand @ 2017-10-16 20:54 ` Rob Herring 0 siblings, 0 replies; 11+ messages in thread From: Rob Herring @ 2017-10-16 20:54 UTC (permalink / raw) To: Frank Rowand Cc: Wang, Alan 1. (NSB - CN/Hangzhou), Pantelis Antoniou, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org On Mon, Oct 16, 2017 at 1:07 AM, Frank Rowand <frowand.list@gmail.com> wrote: > Hi Alan, > > It is Rob's choice of which order to take the patches in. If we have a choice, better to take fixes first so they can be more easily backported. Rob > Either order, it will be a trivial fixup to the second patchset > to go in. > > -Frank > > > On 10/15/17 19:35, Wang, Alan 1. (NSB - CN/Hangzhou) wrote: >> Hi Frank, >> >> Could I continue to send my patch since conflict with your patches? Or I have to wait for your patches merged? Thanks. >> >> -----Original Message----- >> From: Frank Rowand [mailto:frowand.list@gmail.com] >> Sent: Saturday, October 14, 2017 6:05 AM >> To: Wang, Alan 1. (NSB - CN/Hangzhou) <alan.1.wang@nokia-sbell.com>; Pantelis Antoniou <pantelis.antoniou@konsulko.com>; Rob Herring <robh+dt@kernel.org> >> Cc: linux-kernel@vger.kernel.org; devicetree@vger.kernel.org >> Subject: Re: [PATCH] of: overlay: fix memory leak related to duplicated property >> >> Hi Rob, >> >> On 10/12/17 20:07, Lixin Wang wrote: >>> From: alawang <alan.1.wang@nokia-sbell.com> >>> >>> Hello, >>> >>> Sorry It was my fault in last email that wrote the wrong subject and sign off name. >>> Correct them this time. >>> Thanks >>> >>> 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: Lixin Wang <alan.1.wang@nokia-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, >>> >> >> Just a heads up. >> >> This will conflict with my patch series "[PATCH 00/12] of: overlay: clean up device tree overlay code" [1]. The issue that Lixin has identified will still remain after applying my patch series, and can be fixed in the same manner as his patch, just different context, including variable names. >> >> [1] https://lkml.org/lkml/2017/10/2/679 >> >> -Frank >> > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] of: overlay: fix memory leak related to duplicated property 2017-10-13 3:07 ` [PATCH] " Lixin Wang [not found] ` <1507864056-52089-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> @ 2017-10-16 9:54 ` Lixin Wang [not found] ` <1508147672-58291-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: Lixin Wang @ 2017-10-16 9:54 UTC (permalink / raw) To: Pantelis Antoniou, Rob Herring, Frank Rowand Cc: linux-kernel, devicetree, alawang From: alawang <alan.1.wang@nokia-sbell.com> 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: Lixin Wang <alan.1.wang@nokia-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, -- 2.6.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1508147672-58291-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org>]
* Re: [PATCH] of: overlay: fix memory leak related to duplicated property [not found] ` <1508147672-58291-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> @ 2017-10-17 14:06 ` Rob Herring 0 siblings, 0 replies; 11+ messages in thread From: Rob Herring @ 2017-10-17 14:06 UTC (permalink / raw) To: Lixin Wang Cc: Pantelis Antoniou, Frank Rowand, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Mon, Oct 16, 2017 at 4:54 AM, Lixin Wang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> wrote: > From: alawang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> > > 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: Lixin Wang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> > --- > drivers/of/overlay.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) Applied. Your author name and S-o-b name don't match. I fixed up the author name. Please fix your git config. Rob -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] of: overlay: fix memory leak related to duplicated property 2017-10-13 1:53 [PATCH 1/2] of: overlay: fix memory leak related to duplicated property alawang 2017-10-13 3:07 ` [PATCH] " Lixin Wang @ 2017-10-13 21:39 ` Frank Rowand [not found] ` <59E1328D.2040007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: Frank Rowand @ 2017-10-13 21:39 UTC (permalink / raw) To: alawang, Pantelis Antoniou, Rob Herring; +Cc: linux-kernel, devicetree 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@nokia-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 ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <59E1328D.2040007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* RE: [PATCH 1/2] of: overlay: fix memory leak related to duplicated property [not found] ` <59E1328D.2040007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2017-10-16 2:29 ` Wang, Alan 1. (NSB - CN/Hangzhou) 0 siblings, 0 replies; 11+ messages in thread From: Wang, Alan 1. (NSB - CN/Hangzhou) @ 2017-10-16 2:29 UTC (permalink / raw) To: Frank Rowand, Pantelis Antoniou, Rob Herring Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2411 bytes --] 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@gmail.com] Sent: Saturday, October 14, 2017 5:39 AM To: Wang, Alan 1. (NSB - CN/Hangzhou) <alan.1.wang@nokia-sbell.com>; Pantelis Antoniou <pantelis.antoniou@konsulko.com>; Rob Herring <robh+dt@kernel.org> Cc: linux-kernel@vger.kernel.org; devicetree@vger.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@nokia-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 N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·zøzÚÞz)í æèw*\x1fjg¬±¨\x1e¶Ý¢j.ïÛ°\½½MúgjÌæa×\x02' ©Þ¢¸\f¢·¦j:+v¨wèjØm¶ÿ¾\a«êçzZ+ùÝ¢j"ú!¶i ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-10-17 14:06 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-10-13 1:53 [PATCH 1/2] of: overlay: fix memory leak related to duplicated property alawang 2017-10-13 3:07 ` [PATCH] " Lixin Wang [not found] ` <1507864056-52089-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> 2017-10-13 20:49 ` Rob Herring 2017-10-13 22:04 ` Frank Rowand 2017-10-16 2:35 ` Wang, Alan 1. (NSB - CN/Hangzhou) [not found] ` <VI1PR07MB342187128B48F66C464401A2A24F0-ErKcd1u/gBOORytiVngBPTzdlHkvsOLVvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2017-10-16 6:07 ` Frank Rowand 2017-10-16 20:54 ` Rob Herring 2017-10-16 9:54 ` Lixin Wang [not found] ` <1508147672-58291-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org> 2017-10-17 14:06 ` Rob Herring 2017-10-13 21:39 ` [PATCH 1/2] " Frank Rowand [not found] ` <59E1328D.2040007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2017-10-16 2:29 ` Wang, Alan 1. (NSB - CN/Hangzhou)
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).