From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: Fix file reference leak in criu_restore_devices()
Date: Wed, 16 Sep 2026 07:47:41 +0000 [thread overview]
Message-ID: <20260916074742.309571F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916074216.1973191-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/amdkfd: uninitialized pointer dereference in criu_restore_devices()
--
commit 40984d73f07608e70e87d6e7d3692de70675fb26
Author: Wentao Liang <vulab@iscas.ac.cn>
drm/amdkfd: Fix file reference leak in criu_restore_devices()
This commit attempts to fix a file reference count leak in
criu_restore_devices() by calling fput() when a drm_file is already set
on the process device data structure.
Cc: stable@vger.kernel.org
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -2380,6 +2380,7 @@ static int criu_restore_devices(struct kfd_process *p,
> }
>
> if (pdd->drm_file) {
> + fput(drm_file);
[Severity: High]
Could this lead to an uninitialized pointer dereference?
Looking at criu_restore_devices(), the variable drm_file is declared as an
uninitialized local variable inside the loop:
for (i = 0; i < args->num_devices; i++) {
...
struct file *drm_file;
...
if (pdd->drm_file) {
fput(drm_file);
...
}
...
drm_file = fget(device_buckets[i].drm_fd);
}
At the point where fput(drm_file) is called in this new error path, drm_file
has not yet been assigned a value via fget().
If this error path is taken on the first iteration, it seems like fput()
would be called on uninitialized stack memory. If it happens on a subsequent
iteration, could this result in a double-free of the reference from the
previous iteration?
> ret = -EINVAL;
> goto exit;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260916074216.1973191-1-vulab@iscas.ac.cn?part=1
next prev parent reply other threads:[~2026-09-16 7:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 7:42 [PATCH] drm/amdkfd: Fix file reference leak in criu_restore_devices() Wentao Liang
2026-09-16 7:47 ` sashiko-bot [this message]
2026-09-16 14:27 ` Deucher, Alexander
2026-09-17 2:20 ` kernel test robot
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=20260916074742.309571F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 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.