From: sashiko-bot@kernel.org
To: "Mikko Perttunen" <mperttunen@nvidia.com>
Cc: robh@kernel.org, dri-devel@lists.freedesktop.org,
conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 6/7] drm/tegra: vic: Add Tegra264 support
Date: Mon, 22 Jun 2026 07:11:13 +0000 [thread overview]
Message-ID: <20260622071113.D2A4C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260622-t264-host1x-v2-6-ff7364d9ff7b@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Error paths in vic_load_firmware leave a dangling pointer in vic->falcon.firmware.virt, causing Use-After-Free and Double Free.
--
commit c58aa87e57c2ab3ec5383df99d29ec8f6a79e162
Author: Mikko Perttunen <mperttunen@nvidia.com>
Subject: drm/tegra: vic: Add Tegra264 support
Add support for VIC on Tegra264. The Tegra264 VIC uses a RISC-V based
Falcon microcontroller instead of the traditional Falcon previously,
and has the TRANSCFG register in a different place.
> diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
> index 332c9b563d3f4..46c7e00de3473 100644
> --- a/drivers/gpu/drm/tegra/vic.c
> +++ b/drivers/gpu/drm/tegra/vic.c
[ ... ]
> @@ -302,7 +330,6 @@ static int vic_load_firmware(struct vic *vic)
> return err;
> }
>
[Severity: Critical]
This is a pre-existing issue, but I noticed a potential use-after-free and
double-free in the error handling of vic_load_firmware().
When memory allocation succeeds, the pointers are assigned:
vic->falcon.firmware.virt = virt;
vic->falcon.firmware.iova = iova;
If a subsequent step fails (such as falcon_load_firmware() or
dma_map_single()), the code jumps to the cleanup label, frees the memory,
but does not clear the pointer:
cleanup:
if (!client->group)
dma_free_coherent(vic->dev, size, virt, iova);
else
tegra_drm_free(tegra, size, virt, iova);
mutex_unlock(&lock);
return err;
If vic_load_firmware() is called again (for example, during the next PM runtime
resume), it sees the non-NULL pointer, assumes the firmware is loaded, and
returns 0.
Will this cause the driver to program the hardware to DMA from the freed memory?
Furthermore, when the device is unbound, will the teardown path unconditionally
free vic->falcon.firmware.virt again causing a double-free?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260622-t264-host1x-v2-0-ff7364d9ff7b@nvidia.com?part=6
next prev parent reply other threads:[~2026-06-22 7:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 6:57 [PATCH v2 0/7] Host1x/VIC support on Tegra264 Mikko Perttunen
2026-06-22 6:57 ` [PATCH v2 1/7] dt-bindings: display: tegra: Changes to support Tegra264 Mikko Perttunen
2026-06-22 6:57 ` [PATCH v2 2/7] dt-bindings: display: tegra: Add Tegra264 compatible for VIC Mikko Perttunen
2026-06-22 6:57 ` [PATCH v2 3/7] gpu: host1x: Correctly parse linear ranges of context devices Mikko Perttunen
2026-06-22 7:09 ` sashiko-bot
2026-06-22 6:57 ` [PATCH v2 4/7] gpu: host1x: Add Tegra264 support Mikko Perttunen
2026-06-22 7:05 ` sashiko-bot
2026-06-22 6:57 ` [PATCH v2 5/7] drm/tegra: falcon: Add support for RISC-V external boot Mikko Perttunen
2026-06-22 7:08 ` sashiko-bot
2026-06-22 6:57 ` [PATCH v2 6/7] drm/tegra: vic: Add Tegra264 support Mikko Perttunen
2026-06-22 7:11 ` sashiko-bot [this message]
2026-06-22 6:57 ` [PATCH v2 7/7] arm64: tegra: Add Host1x and VIC on Tegra264 Mikko Perttunen
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=20260622071113.D2A4C1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mperttunen@nvidia.com \
--cc=robh@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