From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Miaoqian Lin <linmq006@gmail.com>,
Inki Dae <inki.dae@samsung.com>,
Jagan Teki <jagan@amarulasolutions.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Marek Vasut <marex@denx.de>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/bridge: samsung-dsim: Fix potential double-free in TE GPIO handling
Date: Mon, 4 Aug 2025 14:29:43 +0200 [thread overview]
Message-ID: <e0121a48-1a69-453b-b58b-8e282956165b@samsung.com> (raw)
In-Reply-To: <20250804122418.104360-1-linmq006@gmail.com>
On 04.08.2025 14:24, Miaoqian Lin wrote:
> The devm_gpiod_get_optional() function uses device-managed resources that
> are automatically cleaned up. The
> gpiod_put() calls in both the error path of samsung_dsim_register_te_irq()
> and in samsung_dsim_unregister_te_irq() are redundant and may lead to
> double-free when the device is removed.
>
> Fixes: e7447128ca4a ("drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/gpu/drm/bridge/samsung-dsim.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index bccc88d25948..6ffaee6b7738 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1691,7 +1691,6 @@ static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, struct device
> IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN, "TE", dsi);
> if (ret) {
> dev_err(dsi->dev, "request interrupt failed with %d\n", ret);
> - gpiod_put(dsi->te_gpio);
> return ret;
> }
>
> @@ -1790,10 +1789,8 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
>
> static void samsung_dsim_unregister_te_irq(struct samsung_dsim *dsi)
> {
> - if (dsi->te_gpio) {
> + if (dsi->te_gpio)
> free_irq(gpiod_to_irq(dsi->te_gpio), dsi);
> - gpiod_put(dsi->te_gpio);
> - }
> }
>
> static int samsung_dsim_host_detach(struct mipi_dsi_host *host,
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
prev parent reply other threads:[~2025-08-04 12:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250804122429eucas1p29db20ca392de43a1d6c113dcd4b1b47d@eucas1p2.samsung.com>
2025-08-04 12:24 ` Miaoqian Lin
2025-08-04 12:29 ` Marek Szyprowski [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=e0121a48-1a69-453b-b58b-8e282956165b@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marex@denx.de \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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®