AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, prike.liang@amd.com, sukhatri@amd.com
Subject: Re: [PATCH V2 2/2] drm/amdgpu/userq: return the memdup_user() error for the user MQD
Date: Wed, 30 Sep 2026 12:25:23 +0200	[thread overview]
Message-ID: <a72f7474-6906-412a-a38f-9ecbd80c8a21@amd.com> (raw)
In-Reply-To: <20260930093912.177219-2-Jesse.Zhang@amd.com>

On 9/30/26 11:38, Jesse Zhang wrote:
> mes_userq_mqd_create() returns -ENOMEM when copying the user MQD fails,
> even though memdup_user() returns -EFAULT for a bad pointer or -EINTR
> when interrupted by a signal. Return PTR_ERR() instead.
> 
> While at it drop the error messages. Neither case is a driver error and
> userspace shouldn't be able to spam the log with invalid IOCTL
> parameters.
> 
> v2: drop the error messages (Christian)
> 
> Fixes: 2c695d7c0720 ("drm/amdgpu: enable compute/gfx usermode queue")
> Fixes: 543b61453774 ("drm/amdgpu: enable SDMA usermode queues")
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index e6c167a39d44..1b76c10d1ac2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -407,8 +407,7 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue,
>  
>  		compute_mqd = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size);
>  		if (IS_ERR(compute_mqd)) {
> -			DRM_ERROR("Failed to read user MQD\n");
> -			r = -ENOMEM;
> +			r = PTR_ERR(compute_mqd);
>  			goto free_mqd;
>  		}
>  
> @@ -452,8 +451,7 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue,
>  
>  		mqd_gfx_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size);
>  		if (IS_ERR(mqd_gfx_v11)) {
> -			DRM_ERROR("Failed to read user MQD\n");
> -			r = -ENOMEM;
> +			r = PTR_ERR(mqd_gfx_v11);
>  			goto free_mqd;
>  		}
>  
> @@ -497,8 +495,7 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue,
>  
>  		mqd_sdma_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size);
>  		if (IS_ERR(mqd_sdma_v11)) {
> -			DRM_ERROR("Failed to read sdma user MQD\n");
> -			r = -ENOMEM;
> +			r = PTR_ERR(mqd_sdma_v11);
>  			goto free_mqd;
>  		}
>  


  reply	other threads:[~2026-09-30 10:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  9:38 [PATCH V2 1/2] drm/amdgpu/userq: only accept doorbell BOs as queue doorbell Jesse Zhang
2026-09-30  9:38 ` [PATCH V2 2/2] drm/amdgpu/userq: return the memdup_user() error for the user MQD Jesse Zhang
2026-09-30 10:25   ` Christian König [this message]
2026-09-30 10:24 ` [PATCH V2 1/2] drm/amdgpu/userq: only accept doorbell BOs as queue doorbell Christian König

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=a72f7474-6906-412a-a38f-9ecbd80c8a21@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=prike.liang@amd.com \
    --cc=sukhatri@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