All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Miquel Raynal (Schneider Electric)" <miquel.raynal@bootlin.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 7/7] clk: tests: Add Kunit testing for nexus nodes
Date: Fri, 07 Aug 2026 15:33:48 +0000	[thread overview]
Message-ID: <20260807153348.DEBCD1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260807-schneider-v7-2-rc1-eip201-upstream-v5-7-8785f9531cf0@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `clk_of_find_node_by_name_kunit` test helper introduces a double-free vulnerability if a KUnit-managed device node is passed as the `from` argument.
--

--- Patch [7]: [PATCH v5 7/7] clk: tests: Add Kunit testing for nexus nodes ---
commit 46e51b3734a9b5d623eb4fdcf34b7fd8442c735e
Author: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>

clk: tests: Add Kunit testing for nexus nodes

This commit adds a nexus node with a child requesting a mapped clock in the
fake DT overlay to verify parsing works correctly. It also introduces a new
KUnit helper similar to of_find_node_by_name() to automatically garbage collect
nodes during testing.

> diff --git a/drivers/clk/clk_kunit_helpers.c b/drivers/clk/clk_kunit_helpers.c
> index 68a28e70bb61c..ab6b2cffcad60 100644
> --- a/drivers/clk/clk_kunit_helpers.c
> +++ b/drivers/clk/clk_kunit_helpers.c

[ ... ]

> +struct device_node *clk_of_find_node_by_name_kunit(struct kunit *test, struct device_node *from,
> +						   const char *name)
> +{
> +	struct device_node *np;
> +	int ret;
> +
> +	np = of_find_node_by_name(from, name);

[Severity: Medium]
Since of_find_node_by_name() drops the reference to the from node, what
happens if a test author chains calls and passes a KUnit-managed node as the
from argument?

Will the underlying function drop the reference while KUnit's deferred
teardown attempts a second of_node_put() on the same node when the test
finishes, leading to a double-free?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260807-schneider-v7-2-rc1-eip201-upstream-v5-0-8785f9531cf0@bootlin.com?part=7

      reply	other threads:[~2026-08-07 15:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 15:24 [PATCH v5 0/7] clk: Add support for clock nexus Miquel Raynal (Schneider Electric)
2026-08-07 15:24 ` [PATCH v5 1/7] dt-bindings: clock: Introduce nexus nodes Miquel Raynal (Schneider Electric)
2026-08-07 15:33   ` sashiko-bot
2026-08-07 15:24 ` [PATCH v5 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing Miquel Raynal (Schneider Electric)
2026-08-07 15:24 ` [PATCH v5 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name() Miquel Raynal (Schneider Electric)
2026-08-07 15:24 ` [PATCH v5 4/7] clk: Improve a couple of comments Miquel Raynal (Schneider Electric)
2026-08-07 16:23   ` Frank Li
2026-08-07 15:24 ` [PATCH v5 5/7] clk: Use the generic OF phandle parsing in only one place Miquel Raynal (Schneider Electric)
2026-08-07 15:41   ` sashiko-bot
2026-08-07 16:26   ` Frank Li
2026-08-07 15:24 ` [PATCH v5 6/7] clk: Add support for clock nexus dt bindings Miquel Raynal (Schneider Electric)
2026-08-07 15:35   ` sashiko-bot
2026-08-07 15:24 ` [PATCH v5 7/7] clk: tests: Add Kunit testing for nexus nodes Miquel Raynal (Schneider Electric)
2026-08-07 15:33   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260807153348.DEBCD1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.