mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Fix file reference leak in criu_restore_devices()
@ 2026-09-16  7:42 Wentao Liang
  2026-09-16 14:27 ` Deucher, Alexander
  2026-09-17  2:20 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-09-16  7:42 UTC (permalink / raw)
  To: Felix.Kuehling
  Cc: airlied, alexander.deucher, amd-gfx, christian.koenig,
	david.yatsin, dri-devel, linux-kernel, rajneesh.bhardwaj, simona,
	Wentao Liang, stable

In criu_restore_devices(), drm_file is obtained using fget(drm_fd). If
pdd->drm_file is already set, the function returns -EINVAL without
releasing the acquired reference via fput(drm_file), leading to a file
reference count leak.

Fix this by adding fput(drm_file) before returning -EINVAL.

Fixes: bef153b70c6e ("drm/amdkfd: CRIU implement gpu_id remapping")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 03b266b26738..5453fa4ce4fd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -2311,6 +2311,7 @@ static int criu_restore_devices(struct kfd_process *p,
 		}
 
 		if (pdd->drm_file) {
+			fput(drm_file);
 			ret = -EINVAL;
 			goto exit;
 		}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-17  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  7:42 [PATCH] drm/amdkfd: Fix file reference leak in criu_restore_devices() Wentao Liang
2026-09-16 14:27 ` Deucher, Alexander
2026-09-17  2:20 ` kernel test robot

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®