* [PATCH] of: overlay: Stop leaking resources on overlay removal @ 2018-04-24 16:19 Jan Kiszka 2018-04-24 17:44 ` Frank Rowand 0 siblings, 1 reply; 7+ messages in thread From: Jan Kiszka @ 2018-04-24 16:19 UTC (permalink / raw) To: Pantelis Antoniou, Rob Herring, Frank Rowand, devicetree Cc: Linux Kernel Mailing List, Alan Tull Only the overlay notifier callbacks have a chance to potentially get hold of references to those two resources, but they do not store them. So it is safe to stop the intentional leaking. See also https://lkml.org/lkml/2018/4/23/1063 and following. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- Ideally, we sort out any remaining worries during the 4.17-rc cycle. drivers/of/overlay.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index b35fe88f1851..3553f1f57a62 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) of_node_put(ovcs->fragments[i].overlay); } kfree(ovcs->fragments); - - /* - * TODO - * - * would like to: kfree(ovcs->overlay_tree); - * but can not since drivers may have pointers into this data - * - * would like to: kfree(ovcs->fdt); - * but can not since drivers may have pointers into this data - */ - + kfree(ovcs->overlay_tree); + kfree(ovcs->fdt); kfree(ovcs); } -- 2.13.6 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] of: overlay: Stop leaking resources on overlay removal 2018-04-24 16:19 [PATCH] of: overlay: Stop leaking resources on overlay removal Jan Kiszka @ 2018-04-24 17:44 ` Frank Rowand 2018-04-24 17:50 ` Jan Kiszka 0 siblings, 1 reply; 7+ messages in thread From: Frank Rowand @ 2018-04-24 17:44 UTC (permalink / raw) To: Jan Kiszka, Pantelis Antoniou, Rob Herring, devicetree Cc: Linux Kernel Mailing List, Alan Tull On 04/24/18 09:19, Jan Kiszka wrote: > Only the overlay notifier callbacks have a chance to potentially get > hold of references to those two resources, but they do not store them. > So it is safe to stop the intentional leaking. > > See also https://lkml.org/lkml/2018/4/23/1063 and following. > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> > --- > > Ideally, we sort out any remaining worries during the 4.17-rc cycle. > > drivers/of/overlay.c | 13 ++----------- > 1 file changed, 2 insertions(+), 11 deletions(-) > > diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c > index b35fe88f1851..3553f1f57a62 100644 > --- a/drivers/of/overlay.c > +++ b/drivers/of/overlay.c > @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) > of_node_put(ovcs->fragments[i].overlay); > } > kfree(ovcs->fragments); > - > - /* > - * TODO > - * > - * would like to: kfree(ovcs->overlay_tree); > - * but can not since drivers may have pointers into this data > - * > - * would like to: kfree(ovcs->fdt); > - * but can not since drivers may have pointers into this data > - */ > - > + kfree(ovcs->overlay_tree); > + kfree(ovcs->fdt); > kfree(ovcs); > } > > Nack. It is premature to submit this while the conversation is continuing in the other thread. I'll continue the conversation in the other thread. -Frank ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] of: overlay: Stop leaking resources on overlay removal 2018-04-24 17:44 ` Frank Rowand @ 2018-04-24 17:50 ` Jan Kiszka 2018-04-24 20:58 ` Frank Rowand 0 siblings, 1 reply; 7+ messages in thread From: Jan Kiszka @ 2018-04-24 17:50 UTC (permalink / raw) To: Frank Rowand, Pantelis Antoniou, Rob Herring, devicetree Cc: Linux Kernel Mailing List, Alan Tull On 2018-04-24 19:44, Frank Rowand wrote: > On 04/24/18 09:19, Jan Kiszka wrote: >> Only the overlay notifier callbacks have a chance to potentially get >> hold of references to those two resources, but they do not store them. >> So it is safe to stop the intentional leaking. >> >> See also https://lkml.org/lkml/2018/4/23/1063 and following. >> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >> --- >> >> Ideally, we sort out any remaining worries during the 4.17-rc cycle. >> >> drivers/of/overlay.c | 13 ++----------- >> 1 file changed, 2 insertions(+), 11 deletions(-) >> >> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c >> index b35fe88f1851..3553f1f57a62 100644 >> --- a/drivers/of/overlay.c >> +++ b/drivers/of/overlay.c >> @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) >> of_node_put(ovcs->fragments[i].overlay); >> } >> kfree(ovcs->fragments); >> - >> - /* >> - * TODO >> - * >> - * would like to: kfree(ovcs->overlay_tree); >> - * but can not since drivers may have pointers into this data >> - * >> - * would like to: kfree(ovcs->fdt); >> - * but can not since drivers may have pointers into this data >> - */ >> - >> + kfree(ovcs->overlay_tree); >> + kfree(ovcs->fdt); >> kfree(ovcs); >> } >> >> > > Nack. It is premature to submit this while the conversation is > continuing in the other thread. > > I'll continue the conversation in the other thread. > Well, at least the strongest argument has been resolved now, the notifier topic. Curious to learn what remains. As I noted, we should work hard to sort out the API regression prior to the release. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] of: overlay: Stop leaking resources on overlay removal 2018-04-24 17:50 ` Jan Kiszka @ 2018-04-24 20:58 ` Frank Rowand 2018-04-26 0:32 ` Frank Rowand 0 siblings, 1 reply; 7+ messages in thread From: Frank Rowand @ 2018-04-24 20:58 UTC (permalink / raw) To: Jan Kiszka, Pantelis Antoniou, Rob Herring, devicetree Cc: Linux Kernel Mailing List, Alan Tull On 04/24/18 10:50, Jan Kiszka wrote: > On 2018-04-24 19:44, Frank Rowand wrote: >> On 04/24/18 09:19, Jan Kiszka wrote: >>> Only the overlay notifier callbacks have a chance to potentially get >>> hold of references to those two resources, but they do not store them. >>> So it is safe to stop the intentional leaking. >>> >>> See also https://lkml.org/lkml/2018/4/23/1063 and following. >>> >>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >>> --- >>> >>> Ideally, we sort out any remaining worries during the 4.17-rc cycle. >>> >>> drivers/of/overlay.c | 13 ++----------- >>> 1 file changed, 2 insertions(+), 11 deletions(-) >>> >>> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c >>> index b35fe88f1851..3553f1f57a62 100644 >>> --- a/drivers/of/overlay.c >>> +++ b/drivers/of/overlay.c >>> @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) >>> of_node_put(ovcs->fragments[i].overlay); >>> } >>> kfree(ovcs->fragments); >>> - >>> - /* >>> - * TODO >>> - * >>> - * would like to: kfree(ovcs->overlay_tree); >>> - * but can not since drivers may have pointers into this data >>> - * >>> - * would like to: kfree(ovcs->fdt); >>> - * but can not since drivers may have pointers into this data >>> - */ >>> - >>> + kfree(ovcs->overlay_tree); >>> + kfree(ovcs->fdt); >>> kfree(ovcs); >>> } >>> >>> >> >> Nack. It is premature to submit this while the conversation is >> continuing in the other thread. >> >> I'll continue the conversation in the other thread. >> > > Well, at least the strongest argument has been resolved now, the > notifier topic. Curious to learn what remains. As I noted, we should > work hard to sort out the API regression prior to the release. Nope, the notifier discussion continues in the other thread. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] of: overlay: Stop leaking resources on overlay removal 2018-04-24 20:58 ` Frank Rowand @ 2018-04-26 0:32 ` Frank Rowand 2018-04-26 0:44 ` Frank Rowand 0 siblings, 1 reply; 7+ messages in thread From: Frank Rowand @ 2018-04-26 0:32 UTC (permalink / raw) To: Jan Kiszka, Pantelis Antoniou, Rob Herring, devicetree Cc: Linux Kernel Mailing List, Alan Tull Hi Jan, On 04/24/18 13:58, Frank Rowand wrote: > On 04/24/18 10:50, Jan Kiszka wrote: >> On 2018-04-24 19:44, Frank Rowand wrote: >>> On 04/24/18 09:19, Jan Kiszka wrote: >>>> Only the overlay notifier callbacks have a chance to potentially get >>>> hold of references to those two resources, but they do not store them. >>>> So it is safe to stop the intentional leaking. >>>> >>>> See also https://lkml.org/lkml/2018/4/23/1063 and following. >>>> >>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >>>> --- >>>> >>>> Ideally, we sort out any remaining worries during the 4.17-rc cycle. >>>> >>>> drivers/of/overlay.c | 13 ++----------- >>>> 1 file changed, 2 insertions(+), 11 deletions(-) >>>> >>>> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c >>>> index b35fe88f1851..3553f1f57a62 100644 >>>> --- a/drivers/of/overlay.c >>>> +++ b/drivers/of/overlay.c >>>> @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) >>>> of_node_put(ovcs->fragments[i].overlay); >>>> } >>>> kfree(ovcs->fragments); >>>> - >>>> - /* >>>> - * TODO >>>> - * >>>> - * would like to: kfree(ovcs->overlay_tree); >>>> - * but can not since drivers may have pointers into this data >>>> - * >>>> - * would like to: kfree(ovcs->fdt); >>>> - * but can not since drivers may have pointers into this data >>>> - */ >>>> - >>>> + kfree(ovcs->overlay_tree); >>>> + kfree(ovcs->fdt); >>>> kfree(ovcs); >>>> } >>>> >>>> >>> >>> Nack. It is premature to submit this while the conversation is >>> continuing in the other thread. >>> >>> I'll continue the conversation in the other thread. >>> >> >> Well, at least the strongest argument has been resolved now, the >> notifier topic. Curious to learn what remains. As I noted, we should >> work hard to sort out the API regression prior to the release. > > Nope, the notifier discussion continues in the other thread. Thanks for your patience in the other thread. As I noted there, I am now willing to accept this patch with some small changes. Please add a minimal section to Documentation/devicetree/overlay-notes.txt about overlay notifiers. The most important thing to note there is that the overlay notifiers are not allowed to retain any pointers into the overlay devicetree. Also, instead of removing the "TODO" comment in free_overlay_changeset(), change it to say something to the effect of "there should be no live pointers into ovcs->overlay_tree and ovcs->fdt due to the policy that overlay notifiers are not allowed to retain pointers into the overlay devicetree". I will also add myself to the OPEN FIRMWARE AND DEVICE TREE OVERLAYS entry of MAINTAINERS and add a keyword line to catch overlay notifiers. I am not happy about freeing the overlay devicetree and overlay fdt while overlay notifiers are able to retain pointers into the overlay devicetree and overlay fdt, but am willing to accept documentation and review as a partial protection until the devicetree access APIs can be modified to prevent the notifiers from accessing the pointers. The volume of overlay notifier patches should be small enough to not be a review burden. -Frank ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] of: overlay: Stop leaking resources on overlay removal 2018-04-26 0:32 ` Frank Rowand @ 2018-04-26 0:44 ` Frank Rowand 2018-04-26 7:31 ` Jan Kiszka 0 siblings, 1 reply; 7+ messages in thread From: Frank Rowand @ 2018-04-26 0:44 UTC (permalink / raw) To: Jan Kiszka, Pantelis Antoniou, Rob Herring, devicetree Cc: Linux Kernel Mailing List, Alan Tull On 04/25/18 17:32, Frank Rowand wrote: > Hi Jan, > > On 04/24/18 13:58, Frank Rowand wrote: >> On 04/24/18 10:50, Jan Kiszka wrote: >>> On 2018-04-24 19:44, Frank Rowand wrote: >>>> On 04/24/18 09:19, Jan Kiszka wrote: >>>>> Only the overlay notifier callbacks have a chance to potentially get >>>>> hold of references to those two resources, but they do not store them. >>>>> So it is safe to stop the intentional leaking. >>>>> >>>>> See also https://lkml.org/lkml/2018/4/23/1063 and following. >>>>> >>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >>>>> --- >>>>> >>>>> Ideally, we sort out any remaining worries during the 4.17-rc cycle. >>>>> >>>>> drivers/of/overlay.c | 13 ++----------- >>>>> 1 file changed, 2 insertions(+), 11 deletions(-) >>>>> >>>>> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c >>>>> index b35fe88f1851..3553f1f57a62 100644 >>>>> --- a/drivers/of/overlay.c >>>>> +++ b/drivers/of/overlay.c >>>>> @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) >>>>> of_node_put(ovcs->fragments[i].overlay); >>>>> } >>>>> kfree(ovcs->fragments); >>>>> - >>>>> - /* >>>>> - * TODO >>>>> - * >>>>> - * would like to: kfree(ovcs->overlay_tree); >>>>> - * but can not since drivers may have pointers into this data >>>>> - * >>>>> - * would like to: kfree(ovcs->fdt); >>>>> - * but can not since drivers may have pointers into this data >>>>> - */ >>>>> - >>>>> + kfree(ovcs->overlay_tree); >>>>> + kfree(ovcs->fdt); >>>>> kfree(ovcs); >>>>> } >>>>> >>>>> >>>> >>>> Nack. It is premature to submit this while the conversation is >>>> continuing in the other thread. >>>> >>>> I'll continue the conversation in the other thread. >>>> >>> >>> Well, at least the strongest argument has been resolved now, the >>> notifier topic. Curious to learn what remains. As I noted, we should >>> work hard to sort out the API regression prior to the release. >> >> Nope, the notifier discussion continues in the other thread. > > Thanks for your patience in the other thread. > > As I noted there, I am now willing to accept this patch with some > small changes. Please add a minimal section to > Documentation/devicetree/overlay-notes.txt about overlay notifiers. > The most important thing to note there is that the overlay notifiers > are not allowed to retain any pointers into the overlay devicetree. Please also add a function header comment to of_overlay_notifier_register() in drivers/of/overlay.c that notes the restriction on the overlay notifier. > Also, instead of removing the "TODO" comment in free_overlay_changeset(), > change it to say something to the effect of "there should be no live pointers > into ovcs->overlay_tree and ovcs->fdt due to the policy that overlay > notifiers are not allowed to retain pointers into the overlay devicetree". > > I will also add myself to the OPEN FIRMWARE AND DEVICE TREE OVERLAYS > entry of MAINTAINERS and add a keyword line to catch overlay notifiers. > > I am not happy about freeing the overlay devicetree and overlay fdt > while overlay notifiers are able to retain pointers into the overlay > devicetree and overlay fdt, but am willing to accept documentation and > review as a partial protection until the devicetree access APIs can be > modified to prevent the notifiers from accessing the pointers. The > volume of overlay notifier patches should be small enough to not be > a review burden. > > -Frank > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] of: overlay: Stop leaking resources on overlay removal 2018-04-26 0:44 ` Frank Rowand @ 2018-04-26 7:31 ` Jan Kiszka 0 siblings, 0 replies; 7+ messages in thread From: Jan Kiszka @ 2018-04-26 7:31 UTC (permalink / raw) To: Frank Rowand, Pantelis Antoniou, Rob Herring, devicetree Cc: Linux Kernel Mailing List, Alan Tull On 2018-04-26 02:44, Frank Rowand wrote: > On 04/25/18 17:32, Frank Rowand wrote: >> Hi Jan, >> >> On 04/24/18 13:58, Frank Rowand wrote: >>> On 04/24/18 10:50, Jan Kiszka wrote: >>>> On 2018-04-24 19:44, Frank Rowand wrote: >>>>> On 04/24/18 09:19, Jan Kiszka wrote: >>>>>> Only the overlay notifier callbacks have a chance to potentially get >>>>>> hold of references to those two resources, but they do not store them. >>>>>> So it is safe to stop the intentional leaking. >>>>>> >>>>>> See also https://lkml.org/lkml/2018/4/23/1063 and following. >>>>>> >>>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >>>>>> --- >>>>>> >>>>>> Ideally, we sort out any remaining worries during the 4.17-rc cycle. >>>>>> >>>>>> drivers/of/overlay.c | 13 ++----------- >>>>>> 1 file changed, 2 insertions(+), 11 deletions(-) >>>>>> >>>>>> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c >>>>>> index b35fe88f1851..3553f1f57a62 100644 >>>>>> --- a/drivers/of/overlay.c >>>>>> +++ b/drivers/of/overlay.c >>>>>> @@ -671,17 +671,8 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) >>>>>> of_node_put(ovcs->fragments[i].overlay); >>>>>> } >>>>>> kfree(ovcs->fragments); >>>>>> - >>>>>> - /* >>>>>> - * TODO >>>>>> - * >>>>>> - * would like to: kfree(ovcs->overlay_tree); >>>>>> - * but can not since drivers may have pointers into this data >>>>>> - * >>>>>> - * would like to: kfree(ovcs->fdt); >>>>>> - * but can not since drivers may have pointers into this data >>>>>> - */ >>>>>> - >>>>>> + kfree(ovcs->overlay_tree); >>>>>> + kfree(ovcs->fdt); >>>>>> kfree(ovcs); >>>>>> } >>>>>> >>>>>> >>>>> >>>>> Nack. It is premature to submit this while the conversation is >>>>> continuing in the other thread. >>>>> >>>>> I'll continue the conversation in the other thread. >>>>> >>>> >>>> Well, at least the strongest argument has been resolved now, the >>>> notifier topic. Curious to learn what remains. As I noted, we should >>>> work hard to sort out the API regression prior to the release. >>> >>> Nope, the notifier discussion continues in the other thread. >> >> Thanks for your patience in the other thread. >> >> As I noted there, I am now willing to accept this patch with some >> small changes. Please add a minimal section to >> Documentation/devicetree/overlay-notes.txt about overlay notifiers. >> The most important thing to note there is that the overlay notifiers >> are not allowed to retain any pointers into the overlay devicetree. > > Please also add a function header comment to of_overlay_notifier_register() > in drivers/of/overlay.c that notes the restriction on the overlay notifier. > > >> Also, instead of removing the "TODO" comment in free_overlay_changeset(), >> change it to say something to the effect of "there should be no live pointers >> into ovcs->overlay_tree and ovcs->fdt due to the policy that overlay >> notifiers are not allowed to retain pointers into the overlay devicetree". >> >> I will also add myself to the OPEN FIRMWARE AND DEVICE TREE OVERLAYS >> entry of MAINTAINERS and add a keyword line to catch overlay notifiers. >> >> I am not happy about freeing the overlay devicetree and overlay fdt >> while overlay notifiers are able to retain pointers into the overlay >> devicetree and overlay fdt, but am willing to accept documentation and >> review as a partial protection until the devicetree access APIs can be >> modified to prevent the notifiers from accessing the pointers. The >> volume of overlay notifier patches should be small enough to not be >> a review burden. >> >> -Frank >> >> > Thanks for reconsidering! I'll look into your change requests soon and come up with v2. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-04-26 7:32 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-04-24 16:19 [PATCH] of: overlay: Stop leaking resources on overlay removal Jan Kiszka 2018-04-24 17:44 ` Frank Rowand 2018-04-24 17:50 ` Jan Kiszka 2018-04-24 20:58 ` Frank Rowand 2018-04-26 0:32 ` Frank Rowand 2018-04-26 0:44 ` Frank Rowand 2018-04-26 7:31 ` Jan Kiszka
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).