From 619b806479686ebc2d3f53122655cfe65332ed8f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 15 Jun 2020 16:14:48 +0200 Subject: [PATCH] 5.7-stable patches added patches: efi-efivars-add-missing-kobject_put-in-sysfs-entry-creation-error-path.patch --- ...t-in-sysfs-entry-creation-error-path.patch | 39 +++++++++++++++++++ queue-5.7/series | 1 + 2 files changed, 40 insertions(+) create mode 100644 queue-5.7/efi-efivars-add-missing-kobject_put-in-sysfs-entry-creation-error-path.patch diff --git a/queue-5.7/efi-efivars-add-missing-kobject_put-in-sysfs-entry-creation-error-path.patch b/queue-5.7/efi-efivars-add-missing-kobject_put-in-sysfs-entry-creation-error-path.patch new file mode 100644 index 00000000000..db028e7f7e5 --- /dev/null +++ b/queue-5.7/efi-efivars-add-missing-kobject_put-in-sysfs-entry-creation-error-path.patch @@ -0,0 +1,39 @@ +From d8bd8c6e2cfab8b78b537715255be8d7557791c0 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Fri, 22 May 2020 18:15:49 +0200 +Subject: efi/efivars: Add missing kobject_put() in sysfs entry creation error path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ard Biesheuvel + +commit d8bd8c6e2cfab8b78b537715255be8d7557791c0 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: +Reported-by: 亿一 +Signed-off-by: Ard Biesheuvel +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/firmware/efi/efivars.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/firmware/efi/efivars.c ++++ b/drivers/firmware/efi/efivars.c +@@ -522,8 +522,10 @@ efivar_create_sysfs_entry(struct efivar_ + ret = kobject_init_and_add(&new_var->kobj, &efivar_ktype, + NULL, "%s", short_name); + kfree(short_name); +- if (ret) ++ if (ret) { ++ kobject_put(&new_var->kobj); + return ret; ++ } + + kobject_uevent(&new_var->kobj, KOBJ_ADD); + if (efivar_entry_add(new_var, &efivar_sysfs_list)) { diff --git a/queue-5.7/series b/queue-5.7/series index 6c567cfd607..f88952c6479 100644 --- a/queue-5.7/series +++ b/queue-5.7/series @@ -54,3 +54,4 @@ io_uring-fix-flush-req-refs-underflow.patch io_uring-re-set-iov-base-len-for-buffer-select-retry.patch io_uring-use-kvfree-in-io_sqe_buffer_register.patch io_uring-allow-o_nonblock-async-retry.patch +efi-efivars-add-missing-kobject_put-in-sysfs-entry-creation-error-path.patch -- 2.47.3