Patch "efi/esrt: Fix reference count leak in esre_create_sysfs_entry." has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    efi/esrt: Fix reference count leak in esre_create_sysfs_entry.

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     efi-esrt-fix-reference-count-leak-in-esre_create_sys.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a9b4a6ee6182fcc8d425adf40b200beae8236139
Author: Qiushi Wu <wu000273@xxxxxxx>
Date:   Thu May 28 13:38:04 2020 -0500

    efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
    
    [ Upstream commit 4ddf4739be6e375116c375f0a68bf3893ffcee21 ]
    
    kobject_init_and_add() takes reference even when it fails.
    If this function returns an error, kobject_put() must be called to
    properly clean up the memory associated with the object. Previous
    commit "b8eb718348b8" fixed a similar problem.
    
    Fixes: 0bb549052d33 ("efi: Add esrt support")
    Signed-off-by: Qiushi Wu <wu000273@xxxxxxx>
    Link: https://lore.kernel.org/r/20200528183804.4497-1-wu000273@xxxxxxx
    Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
index 241dd7c63d2c8..481b2f0a190b0 100644
--- a/drivers/firmware/efi/esrt.c
+++ b/drivers/firmware/efi/esrt.c
@@ -180,7 +180,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
 		rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
 					  "entry%d", entry_num);
 		if (rc) {
-			kfree(entry);
+			kobject_put(&entry->kobj);
 			return rc;
 		}
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux