Re: [PATCH v2 3/3] of: overlay: do not free changeset when of_overlay_apply returns error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 02 May 2022 13:17:42 -0500, frowand.list@xxxxxxxxx wrote:
> From: Frank Rowand <frank.rowand@xxxxxxxx>
> 
> New unittests for overlay notifiers reveal a memory leak in
> of_overlay_apply() when a notifier returns an error for action
> OF_OVERLAY_POST_APPLY.  The pr_err() message is:
> 
>    OF: ERROR: memory leak, expected refcount 1 instead of 3,
>    of_node_get()/of_node_put() unbalanced - destroy cset entry: attach
>    overlay node /testcase-data/overlay-node/test-bus/test-unittest17
> 
> Change the error path to no longer call free_overlay_changeset(),
> and document that the caller of of_overlay_fdt_apply() may choose
> to remove the overlay.
> 
> Update the unittest that triggered the error to expect the changed
> return values and to call of_overlay_remove().
> 
> Signed-off-by: Frank Rowand <frank.rowand@xxxxxxxx>
> ---
> Changes since version 1:
>   - patch 1/1 v1 did not apply on Rob's dt/next branch, rebase on top of
>     5f756a2eaa44 of: overlay: do not break notify on NOTIFY_{OK|STOP}
> 
> Output of the new overlay notifier unittests, as filtered by
> scripts/dtc/of_unittest_expect:
> 
>    ### dt-test ### pass of_unittest_overlay_notify():2825
> ok OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overlay-node/test-bus
>    ### dt-test ### pass of_unittest_overlay_notify():2846
>    ### dt-test ### pass of_unittest_overlay_notify():2851
> ok OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overlay-node/test-bus
>    ### dt-test ### pass of_unittest_overlay_notify():2857
>    ### dt-test ### pass of_unittest_overlay_notify():2862
>    ### dt-test ### pass of_unittest_overlay_notify():2866
>    ### dt-test ### pass of_unittest_overlay_notify():2872
>    ### dt-test ### pass of_unittest_overlay_notify():2875
> ok OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overlay-node/test-bus
>    ### dt-test ### pass of_unittest_overlay_notify():2886
>    ### dt-test ### pass of_unittest_overlay_notify():2894
>    ### dt-test ### pass of_unittest_overlay_notify():2898
>    ### dt-test ### pass of_unittest_overlay_notify():2901
> ok OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overlay-node/test-bus
>    ### dt-test ### pass of_unittest_overlay_notify():2908
>    ### dt-test ### pass of_unittest_overlay_notify():2915
>    ### dt-test ### pass of_unittest_overlay_notify():2920
>    ### dt-test ### pass of_unittest_overlay_notify():2932
> 
> 
>  drivers/of/overlay.c  | 29 ++++++++++++++++++++++++++---
>  drivers/of/unittest.c | 10 ++++++++--
>  2 files changed, 34 insertions(+), 5 deletions(-)
> 

Applied, thanks!



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux