From: "Maíra Canal" <mcanal@igalia.com>
To: Wentao Liang <vulab@iscas.ac.cn>, airlied@gmail.com
Cc: dave.stevenson@raspberrypi.com, dri-devel@lists.freedesktop.org,
kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
simona@ffwll.ch, tzimmermann@suse.de, stable@vger.kernel.org
Subject: Re: [PATCH] drm/vc4: Fix firmware reference leak in vc4_hvs_bind()
Date: Thu, 17 Sep 2026 18:03:30 -0300 [thread overview]
Message-ID: <5f80ac77-c1f4-42cc-bdcd-e4222f72d853@igalia.com> (raw)
In-Reply-To: <20260916154137.2058618-1-vulab@iscas.ac.cn>
Hi Wentao,
On 16/09/26 12:41, Wentao Liang wrote:
> The firmware reference taken via rpi_firmware_get() is leaked when
> either of the devm_clk_get() calls for the core or display clocks
> fails, as both error paths return without releasing it.
>
> Put the firmware reference before returning from both clock lookup
> error paths.
>
> Fixes: 2a001ca00ad5 ("drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection code")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/gpu/drm/vc4/vc4_hvs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
> index ee8d0738501b..20dde4150068 100644
> --- a/drivers/gpu/drm/vc4/vc4_hvs.c
> +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
> @@ -1680,6 +1680,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
> (vc4->gen >= VC4_GEN_6_C) ? "core" : NULL);
> if (IS_ERR(hvs->core_clk)) {
> dev_err(&pdev->dev, "Couldn't get core clock\n");
> + rpi_firmware_put(firmware);
Instead of adding this line twice, move the line `firmware =
rpi_firmware_get(node)` closer to its actual use. Then, you don't need
to add these `rpi_firmware_put()` calls.
The same comment applies to your other PATCH: `[PATCH] drm/vc4: Fix
firmware reference leak in vc4_drm_bind()`.
Best regards,
- Maíra
> return PTR_ERR(hvs->core_clk);
> }
>
> @@ -1687,6 +1688,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
> (vc4->gen >= VC4_GEN_6_C) ? "disp" : NULL);
> if (IS_ERR(hvs->disp_clk)) {
> dev_err(&pdev->dev, "Couldn't get disp clock\n");
> + rpi_firmware_put(firmware);
> return PTR_ERR(hvs->disp_clk);
> }
>
prev parent reply other threads:[~2026-09-17 21:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 15:41 Wentao Liang
2026-09-17 21:03 ` Maíra Canal [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=5f80ac77-c1f4-42cc-bdcd-e4222f72d853@igalia.com \
--to=mcanal@igalia.com \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-list@raspberrypi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
--cc=vulab@iscas.ac.cn \
/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®