mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Oded Gabbay <ogabbay@kernel.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Tomeu Vizoso <tomeu@tomeuvizoso.net>
Cc: David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Triet Hoang <triet.hoang.dev@gmail.com>,
	Sidong Yang <sidong.yang@furiosa.ai>,
	Igor Paunovic <royalnet026@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] accel/rocket: Fix up sched array handling on open and close
Date: Wed, 18 Nov 2026 11:51:52 +0100	[thread overview]
Message-ID: <wyynHb1JRJGu60KFW3VQvQ@sntech.de> (raw)
In-Reply-To: <20261118101901.253550-1-tomeu@tomeuvizoso.net>

Am Mittwoch, 18. November 2026, 11:18:58 Mitteleuropäische Normalzeit schrieb Tomeu Vizoso:
> Don't WARN when drm_sched_entity_init() fails in rocket_job_open().
> It can return -ENOMEM, which is an allocation failure and not a
> driver bug, so it doesn't deserve a stack trace.
> 
> Also free the scheduler array in rocket_job_close() only after the entity
> has been destroyed, so that entity->sched_list never points to freed
> memory.
> 
> Fixes: d341ef030f3c ("accel/rocket: Check allocations before use")
> Fixes: 9bca2b5f1a4f ("accel/rocket: Keep scheduler allocation in rocket_file_priv")
> Suggested-by: Sidong Yang <sidong.yang@furiosa.ai>
> Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
> Link: https://lore.kernel.org/all/20260826113538.42111-1-sidong.yang@furiosa.ai/
> Link: https://lore.kernel.org/all/20260826113538.42111-2-sidong.yang@furiosa.ai/
> ---
> 
> This addresses a mistake I made when I missed the v6 of the
> "accel/rocket: Fix allocation handling and scheduler array leak" series
> and pushed v5 to drm-misc-fixes.
> 
> With these changes, both drm-misc-fixes and drm-misc-next contain the
> same code in these functions and there should be no conflict when the
> two are merged.
> 
> This is to apply to drm-misc-fixes only.
> 
> ---
>  drivers/accel/rocket/rocket_job.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index 7b798a90bc49..454d465a39e3 100644
> --- a/drivers/accel/rocket/rocket_job.c
> +++ b/drivers/accel/rocket/rocket_job.c
> @@ -572,7 +572,7 @@ int rocket_job_open(struct rocket_file_priv *rocket_priv)
>  				    DRM_SCHED_PRIORITY_NORMAL,
>  				    scheds,
>  				    rdev->num_cores, NULL);
> -	if (WARN_ON(ret))
> +	if (ret)
>  		kfree(scheds);
>  	else
>  		rocket_priv->scheds = scheds;
> @@ -584,8 +584,8 @@ void rocket_job_close(struct rocket_file_priv *rocket_priv)
>  {
>  	struct drm_sched_entity *entity = &rocket_priv->sched_entity;
>  
> -	kfree(rocket_priv->scheds);
>  	drm_sched_entity_destroy(entity);
> +	kfree(rocket_priv->scheds);
>  }

Reviewed-by: Heiko Stuebner <heiko@sntech.de>





  reply	other threads:[~2026-11-18 10:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 10:18 Tomeu Vizoso
2026-11-18 10:51 ` Heiko Stübner [this message]
2026-11-18 11:17 ` Tomeu Vizoso

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=wyynHb1JRJGu60KFW3VQvQ@sntech.de \
    --to=heiko@sntech.de \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=royalnet026@gmail.com \
    --cc=sidong.yang@furiosa.ai \
    --cc=simona@ffwll.ch \
    --cc=tomeu@tomeuvizoso.net \
    --cc=triet.hoang.dev@gmail.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®