From: Max Zhen <max.zhen@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>, <ogabbay@kernel.org>,
<quic_jhugo@quicinc.com>, <dri-devel@lists.freedesktop.org>,
<mario.limonciello@amd.com>, <karol.wachowski@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: fix open_ref leak and stale client pointer on dma map failure
Date: Tue, 7 Jul 2026 08:09:12 -0700 [thread overview]
Message-ID: <79627c5e-7ae4-40a6-8181-a611da01256d@amd.com> (raw)
In-Reply-To: <20260707055658.479049-1-lizhi.hou@amd.com>
On 7/6/2026 Mon 22:56, Lizhi Hou wrote:
> amdxdna_gem_obj_open() increments open_ref before attempting to set up
> the DMA address mapping. When amdxdna_dma_map_bo() fails, the function
> returned immediately without rolling back either change made on the first
> open (open_ref == 1 path).
>
> Fix it by decrementing open_ref and clearing abo->client on the error path.
>
> Fixes: ece3e8980907 ("accel/amdxdna: Allow forcing IOVA-based DMA via module parameter")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Max Zhen <max.zhen@amd.com>
> ---
> drivers/accel/amdxdna/amdxdna_gem.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index a4bd9e86bc8d..3f03d2db1603 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -663,8 +663,11 @@ static int amdxdna_gem_obj_open(struct drm_gem_object *gobj, struct drm_file *fi
> /* No need to set up dma addr mapping in PASID mode. */
> if (!amdxdna_pasid_on(abo->client)) {
> ret = amdxdna_dma_map_bo(xdna, abo);
> - if (ret)
> + if (ret) {
> + abo->open_ref--;
> + abo->client = NULL;
> return ret;
> + }
> }
>
> amdxdna_gem_add_bo_usage(abo);
next prev parent reply other threads:[~2026-07-07 15:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 5:56 Lizhi Hou
2026-07-07 15:09 ` Max Zhen [this message]
2026-07-07 17:12 ` Lizhi Hou
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=79627c5e-7ae4-40a6-8181-a611da01256d@amd.com \
--to=max.zhen@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=mario.limonciello@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.com \
/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®