mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: dri-devel@lists.freedesktop.org
Cc: jeff.hugo@oss.qualcomm.com, linux-kernel@vger.kernel.org,
	ogabbay@kernel.org, tomeu@tomeuvizoso.net,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>
Subject: Re: [PATCH] accel/rocket: Fix use-after-free in rocket_ioctl_create_bo()
Date: Mon, 12 Oct 2026 23:22:13 +0200	[thread overview]
Message-ID: <5113180.GXAFRqVoOG@diego> (raw)
In-Reply-To: <20260917180013.2166025-1-vulab@iscas.ac.cn>

Hi,

Am Donnerstag, 17. September 2026, 20:00:13 Mitteleuropäische Sommerzeit schrieb Wentao Liang:
> 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;

I'm not sure, which kernel-version you're on, but it seems this code in
question has been changed back in may in 
commit f706e6a4ce75 ("accel/rocket: fix UAF via dangling GEM handle in
create_bo")  [0] .

Thanks
Heiko


[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f706e6a4ce75585af979aec3dcbdce68bc76306b



      parent reply	other threads:[~2026-10-12 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 18:00 Wentao Liang
2026-10-02 16:16 ` Jeff Hugo
2026-10-12 21:22 ` Heiko Stübner [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=5113180.GXAFRqVoOG@diego \
    --to=heiko@sntech.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --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®