From: sashiko-bot@kernel.org
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: linux-gpio@vger.kernel.org, linux-sound@vger.kernel.org
Subject: Re: [PATCH 06/12] pinctrl: max77620: Fix firmware node reference count underflow
Date: Sat, 05 Dec 2026 06:53:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-251157@kernel.org> (raw)
In-Reply-To: <20261204-pinctrl-fwnode-fix-v1-6-8589cbd35fb2@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] pinctrl: max77620: race on shared
max77620_pinctrl_desc.fwnode in probe
--
commit 8034ada881c8b38819a53fada36d048098ce2cf3
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
pinctrl: max77620: Fix firmware node reference count underflow
This patch drops device_set_node() from max77620_pinctrl_probe() and
instead passes the parent device's firmware node via
max77620_pinctrl_desc.fwnode.
> diff --git a/drivers/pinctrl/pinctrl-max77620.c b/drivers/pinctrl/pinctrl-max77620.c
> index b181cde6d7c5e..27e0fe9adcc92 100644
> --- a/drivers/pinctrl/pinctrl-max77620.c
> +++ b/drivers/pinctrl/pinctrl-max77620.c
[ ... ]
> @@ -572,6 +570,7 @@ static int max77620_pinctrl_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, mpci);
>
> max77620_pinctrl_desc.name = dev_name(&pdev->dev);
> + max77620_pinctrl_desc.fwnode = dev_fwnode(pdev->dev.parent);
[Severity: Medium]
Can concurrent probes race on max77620_pinctrl_desc.fwnode?
max77620_pinctrl_desc is a single file-scope static struct shared by all
instances bound to max77620_pinctrl_driver. Since both max77620-pinctrl
and max20024-pinctrl match this driver, two devices can probe in parallel
because the driver core only takes per-device locks:
CPU0 CPU1
max77620_pinctrl_probe(devA)
max77620_pinctrl_desc.fwnode = ...
devm_pinctrl_register()
pinctrl_init_controller()
kzalloc_obj(*pctldev)
max77620_pinctrl_probe(devB)
max77620_pinctrl_desc.fwnode = ...
fwnode_handle_get(...) <-- gets devB's parent fwnode
This causes devA's pin controller to bind devB's parent firmware node, or
trigger a use-after-free in fwnode_handle_get() if devB's parent is torn
down concurrently. Copying a const template into a per-instance
struct pinctrl_desc in struct max77620_pctrl_info would avoid this race.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-pinctrl-fwnode-fix-v1-0-8589cbd35fb2@gmail.com?part=6
next prev parent reply other threads:[~2026-12-05 6:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 6:38 [PATCH 00/12] pinctrl: Fix firmware node reference count underflows Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 01/12] pinctrl: devicetree: Factor out dt_find_controller() helper Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 02/12] pinctrl: devicetree: Do not re-claim hogs for sibling devices Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 03/12] pinctrl: Add optional fwnode to struct pinctrl_desc Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 04/12] pinctrl: da9062: Fix firmware node reference count underflow Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 05/12] pinctrl: as3722: " Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 06/12] pinctrl: max77620: " Dmitry Torokhov
2026-12-05 6:53 ` sashiko-bot [this message]
2026-12-05 6:38 ` [PATCH 07/12] pinctrl: madera: " Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 08/12] pinctrl: rk805: " Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 09/12] pinctrl: pef2256: " Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 10/12] pinctrl: cirrus: cs42l43: " Dmitry Torokhov
2026-12-05 6:38 ` [PATCH 11/12] pinctrl: max7360: Pass parent fwnode via pinctrl_desc Dmitry Torokhov
2026-12-05 6:57 ` sashiko-bot
2026-12-05 6:38 ` [PATCH 12/12] pinctrl: ep93xx: " Dmitry Torokhov
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-251157@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-sound@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox