Skip to content

RFC Dynamic OF and use after free related fixes

Nuno Sá linux-clk 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest posting 2/24 patches 2 repliesIn review
  2. v2 RFC posting 1/24 patches 0 repliesSuperseded
  3. v1 RFC4 patches 5 repliesSuperseded

Changes in v2 from the cover letter

* add an helper function in '__set_clk_parents()' to set each parent
separately;
* massaged commit message in patch 2/4
("clk: fix clk not being unlinked from consumers list") as per Stephen feedback.

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4clk: clk-conf: properly release of nodesdrivers/clk/clk-conf.c+78 -480 replies
2/4clk: fix clk not being unlinked from consumers listdrivers/clk/clk.c+1 -00 replies
3/4clk: refcount the active parent clk_coredrivers/clk/clk.c+51 -290 replies
4/4clk: use clk_core_unlink_consumer() helperdrivers/clk/clk.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RESEND RFC PATCH v2 0/4] Dynamic OF and use after free related fixes

This series is a collection of fixes with things I encountered when handling a system with device tree overlays "fun". This effectively means
removing and adding devices which led to me the found issues.

patch 1 is fairly straight and indeed an issue related with of_nodes not being put.

For patches 2 and 3, they are only triggered if someone first removes the provider which is a dumb thing to do. However, I guess we should be prepared for that and the framework even has some efforts to deal with these cases (eg: clk_nodrv_ops). That said, patch 2 is more or less straight (even though catching the guilty line wasn't), we add something to a list during resgister, we need to remove it on the unregister path. Patch 3 is a different beast... though I think krefs are the proper solution here, I'm not sure I covered all the corner cases with all the reparenting that might happen (mainly reason why this is RFC). Nullyfing clk_core->parent during unregister might suffice but I'm more in favor of proper refcounting (for now at least). Patch 3 also does not have a fixes tag because I genuily don't know when this became a problem. Maybe right from the beginning?

Patch 4 is just a minor improvement and not really a fix...

v2:
* add an helper function in '__set_clk_parents()' to set each parent
separately;
* massaged commit message in patch 2/4
("clk: fix clk not being unlinked from consumers list") as per Stephen feedback.

Nuno Sá (4):
clk: clk-conf: properly release of nodes
clk: fix clk not being unlinked from consumers list
clk: refcount the active parent clk_core
clk: use clk_core_unlink_consumer() helper

 drivers/clk/clk-conf.c | 126 +++++++++++++++++++++++++----------------
 drivers/clk/clk.c      |  83 +++++++++++++++++----------
 2 files changed, 131 insertions(+), 78 deletions(-)
Signature · 1 line
2.17.1