From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"José Roberto de Souza" <jose.souza@intel.com>,
"Umesh Nerlige Ramappa" <umesh.nerlige.ramappa@intel.com>,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/xe/oa: Fix sync entry leak on OA config emit failure
Date: Thu, 30 Jul 2026 15:20:18 -0700 [thread overview]
Message-ID: <875x1wglwd.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20260715023332.391298-1-lilinmao@kylinos.cn>
On Tue, 14 Jul 2026 19:33:32 -0700, Linmao Li wrote:
>
Hi Linmao,
Sorry for the delay in responding to this patch.
> xe_oa_emit_oa_config() releases the sync entries and the syncs array
> only on its success path. When it fails before the point of no return
> (fence allocation, config buffer allocation or batch submission), it
> returns without touching stream->syncs.
>
> The stream open path handles such failures in the caller, but
> xe_oa_config_locked() propagates the error without any cleanup, so the
> syncs array and the fence references held by the parsed entries are
> leaked. The next config ioctl overwrites stream->syncs, making the
> memory unreachable for good.
>
> Clean up the parsed syncs when xe_oa_emit_oa_config() fails, matching
> the cleanup done by the stream open error path, and reset the stream
> sync state so it does not point at freed entries.
>
> Fixes: 9920c8b88c5c ("drm/xe/oa: Add syncs support to OA config ioctl")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
> drivers/gpu/drm/xe/xe_oa.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> index 2dce6a47202c..b1ce312ea97a 100644
> --- a/drivers/gpu/drm/xe/xe_oa.c
> +++ b/drivers/gpu/drm/xe/xe_oa.c
> @@ -1594,6 +1594,12 @@ static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg)
> config = xchg(&stream->oa_config, config);
> drm_dbg(&stream->oa->xe->drm, "changed to oa config uuid=%s\n",
> stream->oa_config->uuid);
> + } else {
> + while (param.num_syncs--)
> + xe_sync_entry_cleanup(¶m.syncs[param.num_syncs]);
> + kfree(param.syncs);
> + stream->num_syncs = 0;
> + stream->syncs = NULL;
Yes this looks correct to me. Except that we don't need the two lines
above. Can you please resend a v2 deleting the above two lines.
Thanks for the patch,
Ashutosh
> }
>
> err_config_put:
> --
> 2.25.1
>
next prev parent reply other threads:[~2026-07-30 22:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 2:33 [PATCH] drm/xe/oa: Fix sync entry leak on OA config emit failure Linmao Li
2026-07-15 2:40 ` ✓ CI.KUnit: success for " Patchwork
2026-07-15 3:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-15 6:22 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-30 22:20 ` Dixit, Ashutosh [this message]
2026-07-31 1:19 ` [PATCH v2] " Linmao Li
2026-07-31 1:27 ` ✓ CI.KUnit: success for drm/xe/oa: Fix sync entry leak on OA config emit failure (rev2) Patchwork
2026-07-31 2:02 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-31 3:04 ` ✓ Xe.CI.FULL: " Patchwork
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=875x1wglwd.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jose.souza@intel.com \
--cc=lilinmao@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
--cc=umesh.nerlige.ramappa@intel.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