From: Linus Walleij <linusw@kernel.org>
To: Selby Mashiki <mashikiselby@gmail.com>
Cc: Tomer Maimon <tmaimon77@gmail.com>,
Avi Fishman <avifishman70@gmail.com>,
Tali Perry <tali.perry1@gmail.com>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Patrick Venture <venture@google.com>,
Nancy Yuen <yuenn@google.com>,
Benjamin Fair <benjaminfair@google.com>,
openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: nuvoton: fix fwnode_handle leaks in npcm7xx_gpio_of() and npcm8xx_gpio_fw()
Date: Wed, 4 Nov 2026 14:33:38 +0100 [thread overview]
Message-ID: <CAD++jLmTOFRxSrnq3eXYR0QhDRGeRuPYNh141pByURXYv2CdHg@mail.gmail.com> (raw)
In-Reply-To: <20261025184335.447963-1-mashikiselby@gmail.com>
On Sun, Oct 25, 2026 at 7:43 PM Selby Mashiki <mashikiselby@gmail.com> wrote:
> Both npcm7xx_gpio_of() and npcm8xx_gpio_fw() iterate over GPIO bank
> child nodes using for_each_gpiochip_node(dev, child), which holds a
> reference on child during each iteration. Returning early on any of the
> error paths inside the loop leaks the child fwnode_handle reference.
>
> Additionally, both functions call fwnode_property_get_reference_args()
> to parse the "gpio-ranges" property into args, which acquires a
> reference on args.fwnode that is never released.
>
> Use the __free(fwnode_handle) cleanup attribute for child so early
> returns automatically drop the reference, and call
> fwnode_handle_put(args.fwnode) after fwnode_property_get_reference_args()
> succeeds.
>
> Fixes: 3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
> Fixes: acf4884a5717 ("pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver")
> Signed-off-by: Selby Mashiki <mashikiselby@gmail.com>
Patch applied as nonurgent fix.
Yours,
Linus Walleij
prev parent reply other threads:[~2026-11-04 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 18:43 Selby Mashiki
2026-11-04 13:33 ` Linus Walleij [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=CAD++jLmTOFRxSrnq3eXYR0QhDRGeRuPYNh141pByURXYv2CdHg@mail.gmail.com \
--to=linusw@kernel.org \
--cc=andrew@codeconstruct.com.au \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mashikiselby@gmail.com \
--cc=openbmc@lists.ozlabs.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=yuenn@google.com \
/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
all inboxes | Powered by JetHome®