All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Triet Hoang" <triet.hoang.dev@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 2/2] drm/rocket: Keep scheduler allocation in rocket_file_priv
Date: Mon, 17 Aug 2026 14:11:46 +0000	[thread overview]
Message-ID: <20260817141146.911711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260817140110.148873-2-89897892+HMTCT@users.noreply.github.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Deterministic double free in rocket_job_close() for multi-core devices.
--

--- Patch [2]: [PATCH v4 2/2] drm/rocket: Keep scheduler allocation in rocket_file_priv ---
commit 3f1ce60677689fe14af070b96e041b01b9fbc718
Author: Triet Hoang <triet.hoang.dev@gmail.com>

drm/rocket: Keep scheduler allocation in rocket_file_priv

Keep the scheduler allocation in rocket_file_priv and free it
unconditionally in rocket_job_close().

Link: https://lore.kernel.org/all/20260817093009.22359-1-royalnet026@gmail.com/#t

[ ... ]
> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index adcc792541ec1..ff1d9e802024d 100644
> --- a/drivers/accel/rocket/rocket_job.c
> +++ b/drivers/accel/rocket/rocket_job.c
[ ... ]
> @@ -525,6 +528,7 @@ void rocket_job_close(struct rocket_file_priv *rocket_priv)
>  	struct drm_sched_entity *entity = &rocket_priv->sched_entity;
>  
>  	kfree(entity->sched_list);
> +	kfree(rocket_priv->scheds);

[Severity: Critical]
Does this cause a double free of the scheds array on multi-core devices?

When the device has multiple cores (rdev->num_cores > 1),
drm_sched_entity_init() internally assigns the provided scheds array to
entity->sched_list. Since the patch additionally saves this same pointer
to rocket_priv->scheds, both entity->sched_list and rocket_priv->scheds
will point to the exact same heap allocation. 

By calling kfree() on both sequentially, are we freeing the same memory twice?

>  	drm_sched_entity_destroy(entity);
>  }
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817140110.148873-1-89897892+HMTCT@users.noreply.github.com?part=2

  reply	other threads:[~2026-08-17 14:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  5:39 [PATCH] drm/rocket: Check allocations before use Triet Hoang
2026-08-17  5:53 ` sashiko-bot
2026-08-17  7:20   ` [PATCH v2] " Triet Hoang
2026-08-17  7:35     ` sashiko-bot
2026-08-17  9:20     ` Markus Elfring
2026-08-17  9:31       ` [PATCH v3] " Triet Hoang
2026-08-17  9:45         ` sashiko-bot
2026-08-17  9:55         ` Markus Elfring
2026-08-17 11:22           ` Triet Hoang
2026-08-17  9:30     ` [PATCH v2] " Igor Paunovic
2026-08-17 13:14       ` Triet Hoang
2026-08-17 14:01       ` [PATCH v4 1/2] " Triet Hoang
2026-08-17 14:01         ` [PATCH v4 2/2] drm/rocket: Keep scheduler allocation in rocket_file_priv Triet Hoang
2026-08-17 14:11           ` sashiko-bot [this message]
2026-08-17 17:06           ` Markus Elfring
2026-08-17 14:18         ` [PATCH v4 1/2] drm/rocket: Check allocations before use sashiko-bot
2026-08-17 16:40         ` Markus Elfring
2026-08-17 14:28       ` [PATCH v2] " Triet Hoang

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=20260817141146.911711F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=triet.hoang.dev@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.