projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f6d7a48
)
ALSA: hda: fix potential memleak in 'add_widget_node'
author
Ye Bin
<yebin10@huawei.com>
Thu, 10 Nov 2022 14:45:39 +0000
(22:45 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 08:58:25 +0000
(09:58 +0100)
commit
9a5523f72bd2b0d66eef3d58810c6eb7b5ffc143
upstream.
As 'kobject_add' may allocated memory for 'kobject->name' when return error.
And in this function, if call 'kobject_add' failed didn't free kobject.
So call 'kobject_put' to recycling resources.
Signed-off-by: Ye Bin <yebin10@huawei.com>
Cc: <stable@vger.kernel.org>
Link:
https://lore.kernel.org/r/20221110144539.2989354-1-yebin@huaweicloud.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/hda/hdac_sysfs.c
patch
|
blob
|
history
diff --git
a/sound/hda/hdac_sysfs.c
b/sound/hda/hdac_sysfs.c
index 0d7771fca9f06642059e84ce688ad8498d2a854d..6b8d1565374904eddba1dfb7d403bd34c1711511 100644
(file)
--- a/
sound/hda/hdac_sysfs.c
+++ b/
sound/hda/hdac_sysfs.c
@@
-346,8
+346,10
@@
static int add_widget_node(struct kobject *parent, hda_nid_t nid,
return -ENOMEM;
kobject_init(kobj, &widget_ktype);
err = kobject_add(kobj, parent, "%02x", nid);
- if (err < 0)
+ if (err < 0) {
+ kobject_put(kobj);
return err;
+ }
err = sysfs_create_group(kobj, group);
if (err < 0) {
kobject_put(kobj);