mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: David Airlie <airlied@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Simona Vetter <simona@ffwll.ch>,
	Thomas Zimmermann <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"André Almeida" <andrealmeid@igalia.com>,
	"Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>
Subject: Re: [PATCH] drm/gem: Correct error condition in drm_gem_objects_lookup
Date: Wed, 26 Nov 2025 11:21:15 +0000	[thread overview]
Message-ID: <f2d0fa55-05d3-4d1e-9f1d-a8c326fbcc40@arm.com> (raw)
In-Reply-To: <20251124112039.117748-1-steven.price@arm.com>

On 24/11/2025 11:20, Steven Price wrote:
> When vmemdup_array_user() fails, 'handles' is set to a negative error
> code and no memory is allocated. So the call to kvfree() should not
> happen. Instead just return early with the error code.
> 
> Fixes: cb77b79abf5f ("drm/gem: Use vmemdup_array_user in drm_gem_objects_lookup")
> Signed-off-by: Steven Price <steven.price@arm.com>

Applied to drm-misc-next.

> ---
>  drivers/gpu/drm/drm_gem.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 68168d58a7c8..efc79bbf3c73 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -798,13 +798,10 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
>  	*objs_out = objs;
>  
>  	handles = vmemdup_array_user(bo_handles, count, sizeof(u32));
> -	if (IS_ERR(handles)) {
> -		ret = PTR_ERR(handles);
> -		goto out;
> -	}
> +	if (IS_ERR(handles))
> +		return PTR_ERR(handles);
>  
>  	ret = objects_lookup(filp, handles, count, objs);
> -out:
>  	kvfree(handles);
>  	return ret;
>  


      parent reply	other threads:[~2025-11-26 11:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24 11:20 Steven Price
2025-11-24 11:31 ` Tvrtko Ursulin
2025-11-26 11:21 ` Steven Price [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=f2d0fa55-05d3-4d1e-9f1d-a8c326fbcc40@arm.com \
    --to=steven.price@arm.com \
    --cc=airlied@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tvrtko.ursulin@igalia.com \
    --cc=tzimmermann@suse.de \
    /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®