From: sashiko-bot@kernel.org
To: "Maciej Strozek" <mstrozek@opensource.cirrus.com>
Cc: linux-gpio@vger.kernel.org, linux-sound@vger.kernel.org
Subject: Re: [PATCH] pinctrl: cs42l43: Add GPIO controlled mic/spk mute LEDs
Date: Tue, 10 Nov 2026 14:40:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-207202@kernel.org> (raw)
In-Reply-To: <20261110142058.354518-1-mstrozek@opensource.cirrus.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] pinctrl: cirrus: cs42l43: unbalanced fwnode put in
cs42l43_pin_probe() [1]
--
commit 1aa7ff7b2b9b125f7c2e43385c49822080f93214
Author: Maciej Strozek <mstrozek@opensource.cirrus.com>
pinctrl: cs42l43: Add GPIO controlled mic/spk mute LEDs
This commit adds support for driving speaker and microphone mute LEDs via
cs42l43 GPIOs when described by ACPI properties.
> diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> index a1c839b355578..44a9a759e0f65 100644
> --- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> +++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
[ ... ]
> @@ -598,6 +748,12 @@ static int cs42l43_pin_probe(struct platform_device *pdev)
> return dev_err_probe(priv->dev, ret,
> "Failed to register gpiochip\n");
>
> +#if IS_REACHABLE(CONFIG_LEDS_CLASS)
> + ret = cs42l43_mute_leds_register(priv, dev_fwnode(cs42l43->dev));
> + if (ret)
> + return ret;
> +#endif
> +
> return 0;
> }
[Severity: High]
This problem wasn't introduced by this patch, but does assigning fwnode via
device_set_node() in cs42l43_pin_probe() cause an unbalanced
fwnode_handle_put() [1] when the platform device is released?
Earlier in cs42l43_pin_probe(), fwnode is initialized from the parent MFD
device or looked up from the "pinctrl" child node, and then assigned to
priv->dev:
drivers/pinctrl/cirrus/pinctrl-cs42l43.c:cs42l43_pin_probe() {
...
if (is_of_node(fwnode)) {
struct fwnode_handle *child;
child = fwnode_get_named_child_node(fwnode, "pinctrl");
if (child) {
ret = devm_add_action_or_reset(&pdev->dev,
cs42l43_fwnode_put, child);
if (ret)
return ret;
if (!child->dev)
child->dev = priv->dev;
fwnode = child;
}
}
priv->gpio_chip.fwnode = fwnode;
device_set_node(priv->dev, fwnode);
...
}
Unlike device_add_software_node(), device_set_node() does not acquire a
reference on fwnode, whereas platform_device_release() unconditionally drops a
reference on non-software nodes when the platform device is freed:
drivers/base/platform.c:platform_device_release() {
...
if (!is_software_node(dev_fwnode(dev)))
fwnode_handle_put(pa->pdev.dev.fwnode);
...
}
When the "pinctrl" child node is present, its single reference from
fwnode_get_named_child_node() is already released by cs42l43_fwnode_put() via
devres; otherwise fwnode belongs to cs42l43->dev with no extra reference
taken. When the platform device is later unregistered,
platform_device_release() puts pdev->dev.fwnode an extra time, underflowing
the fwnode reference count and risking a use-after-free.
[1] https://sashiko.dev/#/bug/linux-a633bdf8-b5fe-4770-b14c-d3532525ae12
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110142058.354518-1-mstrozek@opensource.cirrus.com?part=1
next prev parent reply other threads:[~2026-11-10 14:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 14:20 [PATCH] pinctrl: cs42l43: Add GPIO controlled mic/spk mute LEDs Maciej Strozek
2026-11-10 14:40 ` sashiko-bot [this message]
2026-11-11 11:01 ` Charles Keepax
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=sashiko-outbox-207202@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mstrozek@opensource.cirrus.com \
--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.