From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: Matthew Auld <matthew.auld@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] drm/xe/ct: fix xa_store() error checking
Date: Tue, 1 Oct 2024 19:18:03 +0530 [thread overview]
Message-ID: <f761b5e4-68fe-4620-b55e-e05d7f2dae5b@intel.com> (raw)
In-Reply-To: <20241001084346.98516-6-matthew.auld@intel.com>
On 01-10-2024 14:13, Matthew Auld wrote:
> Looks like we are meant to use xa_err() to extract the error encoded in
> the ptr.
>
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Badal Nilawar <badal.nilawar@intel.com>
> Cc: <stable@vger.kernel.org> # v6.8+
> ---
> drivers/gpu/drm/xe/xe_guc_ct.c | 23 ++++++++---------------
> 1 file changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 44263b3cd8c7..d3de2e6d690f 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -667,16 +667,12 @@ static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
> num_g2h = 1;
>
> if (g2h_fence_needs_alloc(g2h_fence)) {
> - void *ptr;
> -
> g2h_fence->seqno = next_ct_seqno(ct, true);
> - ptr = xa_store(&ct->fence_lookup,
> - g2h_fence->seqno,
> - g2h_fence, GFP_ATOMIC);
> - if (IS_ERR(ptr)) {
> - ret = PTR_ERR(ptr);
> + ret = xa_err(xa_store(&ct->fence_lookup,
> + g2h_fence->seqno, g2h_fence,
> + GFP_ATOMIC));
> + if (ret)
> goto out;
> - }
> }
>
> seqno = g2h_fence->seqno;
> @@ -879,14 +875,11 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
> retry_same_fence:
> ret = guc_ct_send(ct, action, len, 0, 0, &g2h_fence);
> if (unlikely(ret == -ENOMEM)) {
> - void *ptr;
> -
> /* Retry allocation /w GFP_KERNEL */
> - ptr = xa_store(&ct->fence_lookup,
> - g2h_fence.seqno,
> - &g2h_fence, GFP_KERNEL);
> - if (IS_ERR(ptr))
> - return PTR_ERR(ptr);
> + ret = xa_err(xa_store(&ct->fence_lookup, g2h_fence.seqno,
> + &g2h_fence, GFP_KERNEL));
> + if (ret)
> + return ret;
Looks good to me.
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Regards,
Badal
>
> goto retry_same_fence;
> } else if (unlikely(ret)) {
next prev parent reply other threads:[~2024-10-01 13:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 8:43 [PATCH v2 1/4] drm/xe/ct: prevent UAF in send_recv() Matthew Auld
2024-10-01 8:43 ` [PATCH v2 2/4] drm/xe/ct: fix xa_store() error checking Matthew Auld
2024-10-01 13:48 ` Nilawar, Badal [this message]
2024-10-01 8:43 ` [PATCH v2 3/4] drm/xe/guc_submit: " Matthew Auld
2024-10-01 13:50 ` Nilawar, Badal
2024-10-01 13:22 ` [PATCH v2 1/4] drm/xe/ct: prevent UAF in send_recv() Nilawar, Badal
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=f761b5e4-68fe-4620-b55e-e05d7f2dae5b@intel.com \
--to=badal.nilawar@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=stable@vger.kernel.org \
/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