Skip to content

Commit b5b78a6

Browse files
Bernard Zhaoalexdeucher
authored andcommitted
drm/amd: fix potential memleak in err branch
The function kobject_init_and_add alloc memory like: kobject_init_and_add->kobject_add_varg->kobject_set_name_vargs ->kvasprintf_const->kstrdup_const->kstrdup->kmalloc_track_caller ->kmalloc_slab, in err branch this memory not free. If use kmemleak, this path maybe catched. These changes are to add kobject_put in kobject_init_and_add failed branch, fix potential memleak. Signed-off-by: Bernard Zhao <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent fa7041d commit b5b78a6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_process.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ struct kfd_process *kfd_create_process(struct file *filep)
428428
(int)process->lead_thread->pid);
429429
if (ret) {
430430
pr_warn("Creating procfs pid directory failed");
431+
kobject_put(process->kobj);
431432
goto out;
432433
}
433434

0 commit comments

Comments
 (0)