* [PATCH] accel/rocket: Fix up sched array handling on open and close
@ 2026-11-18 10:18 Tomeu Vizoso
2026-11-18 10:51 ` Heiko Stübner
2026-11-18 11:17 ` Tomeu Vizoso
0 siblings, 2 replies; 3+ messages in thread
From: Tomeu Vizoso @ 2026-11-18 10:18 UTC (permalink / raw)
To: Heiko Stuebner, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann
Cc: David Airlie, Simona Vetter, Triet Hoang, Sidong Yang,
Igor Paunovic, dri-devel, linux-kernel
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);
}
int rocket_job_is_idle(struct rocket_core *core)
base-commit: f9fc6da01a290609428d308033143f1d96ab658f
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] accel/rocket: Fix up sched array handling on open and close
2026-11-18 10:18 [PATCH] accel/rocket: Fix up sched array handling on open and close Tomeu Vizoso
@ 2026-11-18 10:51 ` Heiko Stübner
2026-11-18 11:17 ` Tomeu Vizoso
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Stübner @ 2026-11-18 10:51 UTC (permalink / raw)
To: Oded Gabbay, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Tomeu Vizoso
Cc: David Airlie, Simona Vetter, Triet Hoang, Sidong Yang,
Igor Paunovic, dri-devel, linux-kernel
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>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] accel/rocket: Fix up sched array handling on open and close
2026-11-18 10:18 [PATCH] accel/rocket: Fix up sched array handling on open and close Tomeu Vizoso
2026-11-18 10:51 ` Heiko Stübner
@ 2026-11-18 11:17 ` Tomeu Vizoso
1 sibling, 0 replies; 3+ messages in thread
From: Tomeu Vizoso @ 2026-11-18 11:17 UTC (permalink / raw)
To: Heiko Stuebner, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Tomeu Vizoso
Cc: David Airlie, Simona Vetter, Triet Hoang, Sidong Yang,
Igor Paunovic, dri-devel, linux-kernel
On Wed, 18 Nov 2026 11:18:58 +0100, Tomeu Vizoso wrote:
> 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.
>
> [...]
Applied to drm-misc-fixes.
[1/1] accel/rocket: Fix up sched array handling on open and close
commit: a23e1f240f4309013e8e7d877944748f24a64a73
Best regards,
--
Tomeu Vizoso <tomeu@tomeuvizoso.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-18 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 10:18 [PATCH] accel/rocket: Fix up sched array handling on open and close Tomeu Vizoso
2026-11-18 10:51 ` Heiko Stübner
2026-11-18 11:17 ` Tomeu Vizoso
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®