Commit d1b4430f authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Khalid Elmously

efi/efivars: Add missing kobject_put() in sysfs entry creation error path

BugLink: https://bugs.launchpad.net/bugs/1884564

commit d8bd8c6e upstream.

The documentation provided by kobject_init_and_add() clearly spells out
the need to call kobject_put() on the kobject if an error is returned.
Add this missing call to the error path.

Cc: <stable@vger.kernel.org>
Reported-by: default avatar亿一 <teroincn@gmail.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent c6d4b3d6
...@@ -585,8 +585,10 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var) ...@@ -585,8 +585,10 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var)
ret = kobject_init_and_add(&new_var->kobj, &efivar_ktype, ret = kobject_init_and_add(&new_var->kobj, &efivar_ktype,
NULL, "%s", short_name); NULL, "%s", short_name);
kfree(short_name); kfree(short_name);
if (ret) if (ret) {
kobject_put(&new_var->kobj);
return ret; return ret;
}
kobject_uevent(&new_var->kobj, KOBJ_ADD); kobject_uevent(&new_var->kobj, KOBJ_ADD);
efivar_entry_add(new_var, &efivar_sysfs_list); efivar_entry_add(new_var, &efivar_sysfs_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment