Skip to contentSkip to conversation

drm/amdkfd: fix process reference drop on debug ioctl

PATCH In review Jonathan Kim 2 participants 2 messages Feb 21, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: fix process reference drop on debug ioctl

Prevent dropping the KFD process reference at the end of a debug IOCTL call where the acquired process value is an error.

---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1 -0
index 80e90fdef291..824e660283b2 100644
@@ -2935,6 +2935,7 @@ static int kfd_ioctl_set_debug_trap(struct file *filep, struct kfd_process *p, v
 	if (IS_ERR_OR_NULL(target)) {
 		pr_debug("Cannot find process PID %i to debug\n", args->pid);
 		r = target ? PTR_ERR(target) : -ESRCH;
+		target = NULL;
 		goto out;
 	}
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jonathan Kim

Prevent dropping the KFD process reference at the end of a debug IOCTL call where the acquired process value is an error.

Quoted 16 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1 -0
index 80e90fdef291..824e660283b2 100644
@@ -2935,6 +2935,7 @@ static int kfd_ioctl_set_debug_trap(struct file *filep, struct kfd_process *p, v
  	if (IS_ERR_OR_NULL(target)) {
  		pr_debug("Cannot find process PID %i to debug\n", args->pid);
  		r = target ? PTR_ERR(target) : -ESRCH;
+		target = NULL;
  		goto out;
  	}