From: Felix Kuehling <felix.kuehling@amd.com>
To: Karl Mehltretter <kmehltretter@gmail.com>,
Mukul Joshi <mukul.joshi@amd.com>,
Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH next] drm/amdgpu: Initialize UALink handle uniqueness state
Date: Wed, 16 Sep 2026 13:41:29 -0400 [thread overview]
Message-ID: <79d276fc-865f-4723-a9fb-93e4b1564535@amd.com> (raw)
In-Reply-To: <20260914054604.12850-1-kmehltretter@gmail.com>
On 2026-09-14 01:46, Karl Mehltretter wrote:
> amdgpu_generate_ualink_handle() continues when handle_lo is zero. For
> accelerator ID 0, the random value can become zero after the low 10 bits
> are cleared. This path reaches while (!unique) without assigning unique.
>
> Clang's -Wconditional-uninitialized reports the read. A reduced
> MemorySanitizer test reports use-of-uninitialized-value at the loop
> condition.
>
> If the uninitialized value ends the loop, handle 0 is inserted into
> exp_xa while robj->ualink_handle_lo still says that the BO has no handle.
> A later export can create another entry for the same BO.
>
> Initialize unique to false so the zero-handle path repeats the loop.
>
> Fixes: c67cb19811ec ("drm/amdgpu: Implement UALink handle export")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Thanks for the catch. I'm applying the patch to amd-staging-drm-next.
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Mukul is looking into the other pre-existing issues pointed out by Sashiko.
Regards,
Felix
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> index ab56420..c6b7122 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> @@ -1819,7 +1819,7 @@ static void amdgpu_ualink_npa_mm_fini(struct amdgpu_device *adev)
> static void amdgpu_generate_ualink_handle(struct amdgpu_device *adev,
> struct amdgpu_ualink_handle *handle)
> {
> - bool unique;
> + bool unique = false;
>
> do {
> handle->handle_lo = get_random_u64();
> base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
prev parent reply other threads:[~2026-09-16 17:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 5:46 Karl Mehltretter
2026-09-16 17:41 ` Felix Kuehling [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=79d276fc-865f-4723-a9fb-93e4b1564535@amd.com \
--to=felix.kuehling@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mukul.joshi@amd.com \
--cc=simona@ffwll.ch \
/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®