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 <bernard@vivo.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
f29aa08852
commit
dc2f832ecb
@ -539,6 +539,7 @@ struct kfd_process *kfd_create_process(struct file *filep)
|
|||||||
(int)process->lead_thread->pid);
|
(int)process->lead_thread->pid);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_warn("Creating procfs pid directory failed");
|
pr_warn("Creating procfs pid directory failed");
|
||||||
|
kobject_put(process->kobj);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user