mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: Wentao Liang <vulab@iscas.ac.cn>, dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, ogabbay@kernel.org,
	tomeu@tomeuvizoso.net, stable@vger.kernel.org
Subject: Re: [PATCH] accel/rocket: Fix use-after-free in rocket_ioctl_create_bo()
Date: Fri, 2 Oct 2026 10:16:21 -0600	[thread overview]
Message-ID: <ad9beb13-92d3-4131-86a2-e7684fc1647c@oss.qualcomm.com> (raw)
In-Reply-To: <20260917180013.2166025-1-vulab@iscas.ac.cn>

On 9/17/2026 12:00 PM, Wentao Liang wrote:
> If drm_gem_handle_create() fails, it takes and then releases its handle
> reference internally, leaving the creator's reference as the only one
> held.  The drm_gem_object_put() then drops that last reference, freeing
> the object via rocket_gem_bo_free(), and the subsequent goto err makes
> drm_gem_shmem_object_free() run on the already freed object.
> 
> Return directly on the error instead: the put has already released
> everything the function acquired at this point, so there is nothing
> left to clean up on the err path.
> 
> Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>   drivers/accel/rocket/rocket_gem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
> index 91095d1b3066..521819041475 100644
> --- a/drivers/accel/rocket/rocket_gem.c
> +++ b/drivers/accel/rocket/rocket_gem.c
> @@ -82,7 +82,7 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
>   	ret = drm_gem_handle_create(file, gem_obj, &args->handle);
>   	drm_gem_object_put(gem_obj);
>   	if (ret)
> -		goto err;
> +		return ret;
>   
>   	sgt = drm_gem_shmem_get_pages_sgt(shmem_obj);
>   	if (IS_ERR(sgt)) {


Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

      reply	other threads:[~2026-10-02 16:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 18:00 Wentao Liang
2026-10-02 16:16 ` Jeff Hugo [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=ad9beb13-92d3-4131-86a2-e7684fc1647c@oss.qualcomm.com \
    --to=jeff.hugo@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tomeu@tomeuvizoso.net \
    --cc=vulab@iscas.ac.cn \
    /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®