]> git.baikalelectronics.ru Git - kernel.git/commit
efi: Fix error handling in add_sysfs_runtime_map_entry()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 21 Apr 2015 13:46:28 +0000 (16:46 +0300)
committerMatt Fleming <matt.fleming@intel.com>
Tue, 5 May 2015 15:20:13 +0000 (16:20 +0100)
commitfb7208e77a5f3c2196d4892ac932d80b1d96f409
tree8b405a9337c27c2ae7b64080a88806f88d8c7363
parent1f635404cc5b7e42bfb14cb8a7c631fc34163dc7
efi: Fix error handling in add_sysfs_runtime_map_entry()

I spotted two (difficult to hit) bugs while reviewing this.

1)  There is a double free bug because we unregister "map_kset" in
    add_sysfs_runtime_map_entry() and also efi_runtime_map_init().
2)  If we fail to allocate "entry" then we should return
    ERR_PTR(-ENOMEM) instead of NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Guangyu Sun <guangyu.sun@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
drivers/firmware/efi/runtime-map.c