From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Justin Yeh <justin.yeh@mediatek.com>,
Sean Wang <sean.wang@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: Project_Global_Chrome_Upstream_Group@mediatek.com,
linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Chen-Yu Tsai <wenst@chromium.org>
Subject: Re: [PATCH v7 1/5] pinctrl: mediatek: use devm_gpiochip_add_data() for GPIO chip
Date: Mon, 7 Sep 2026 11:15:01 +0200 [thread overview]
Message-ID: <468b57bd-6f82-4dc7-82ad-71838b6ac12b@collabora.com> (raw)
In-Reply-To: <20260723035823.2041832-2-justin.yeh@mediatek.com>
On 7/23/26 05:58, Justin Yeh wrote:
> The gpio_chip is allocated with device-managed memory but registered with
> the non-managed gpiochip_add_data(). This was harmless while the drivers
> were built-in, but once they can be built as modules and unbound/rmmod'd,
> devm frees the gpio_chip's memory while it is still registered, causing a
> use-after-free.
>
> Register it with devm_gpiochip_add_data() so it shares the same
> device-managed lifecycle, which also lets the manual gpiochip_remove()
> error paths go away.
>
> Fixes: a6df410d420a ("pinctrl: mediatek: Add Pinctrl/GPIO driver for mt8135.")
> Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
> Fixes: e78d57b2f87c ("pinctrl: mediatek: add pinctrl-moore that implements the generic pinctrl dt-bindings")
> Signed-off-by: Justin Yeh <justin.yeh@mediatek.com>
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
next prev parent reply other threads:[~2026-09-07 9:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 3:58 [PATCH v7 0/5] pinctrl: mediatek: Enable module build support Justin Yeh
2026-07-23 3:58 ` [PATCH v7 1/5] pinctrl: mediatek: use devm_gpiochip_add_data() for GPIO chip Justin Yeh
2026-09-07 9:15 ` AngeloGioacchino Del Regno [this message]
2026-07-23 3:58 ` [PATCH v7 2/5] pinctrl: mediatek: free EINT resources on unbind Justin Yeh
2026-07-23 3:58 ` [PATCH v7 3/5] pinctrl: mediatek: allow common drivers to be built as modules Justin Yeh
2026-07-24 12:24 ` AngeloGioacchino Del Regno
2026-07-23 3:58 ` [PATCH v7 4/5] pinctrl: mediatek: mt7986: register both platform drivers from a single initcall Justin Yeh
2026-07-24 12:24 ` AngeloGioacchino Del Regno
2026-07-23 3:58 ` [PATCH v7 5/5] pinctrl: mediatek: enable module build support for all SoC drivers Justin Yeh
2026-07-25 13:02 ` [PATCH v7 0/5] pinctrl: mediatek: Enable module build support Linus Walleij
2026-07-25 13:10 ` Linus Walleij
2026-07-27 5:08 ` Justin Yeh (葉英茂)
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=468b57bd-6f82-4dc7-82ad-71838b6ac12b@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=justin.yeh@mediatek.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=sean.wang@kernel.org \
--cc=wenst@chromium.org \
/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