Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming...
authorIngo Molnar <mingo@kernel.org>
Wed, 6 May 2015 06:29:37 +0000 (08:29 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 6 May 2015 06:30:24 +0000 (08:30 +0200)
Pull EFI fixes from Matt Fleming:

 * Avoid garbage names in efivarfs due to buggy firmware by zeroing
   EFI variable name. (Ross Lagerwall)

 * Stop erroneously dropping upper 32 bits of boot command line pointer
   in EFI boot stub and stash them in ext_cmd_line_ptr. (Roy Franz)

 * Fix double-free bug in error handling code path of EFI runtime map
   code. (Dan Carpenter)

Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/boot/compressed/eboot.c
drivers/firmware/efi/runtime-map.c
fs/efivarfs/super.c

index ef17683484e9b308e2cb89312258dfe1e62e2d72..48304b89b601fa92bbd8ee1f5e548b4c2ffcc2dc 100644 (file)
@@ -1109,6 +1109,8 @@ struct boot_params *make_boot_params(struct efi_config *c)
        if (!cmdline_ptr)
                goto fail;
        hdr->cmd_line_ptr = (unsigned long)cmdline_ptr;
+       /* Fill in upper bits of command line address, NOP on 32 bit  */
+       boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32;
 
        hdr->ramdisk_image = 0;
        hdr->ramdisk_size = 0;
index 87b8e3b900d2195bc44ae471003db4ad610b7d77..5c55227a34c8fd8ba0b95a6babfb28e4726da8fe 100644 (file)
@@ -120,7 +120,8 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
        entry = kzalloc(sizeof(*entry), GFP_KERNEL);
        if (!entry) {
                kset_unregister(map_kset);
-               return entry;
+               map_kset = NULL;
+               return ERR_PTR(-ENOMEM);
        }
 
        memcpy(&entry->md, efi_runtime_map + nr * efi_memdesc_size,
@@ -132,6 +133,7 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
        if (ret) {
                kobject_put(&entry->kobj);
                kset_unregister(map_kset);
+               map_kset = NULL;
                return ERR_PTR(ret);
        }
 
@@ -195,8 +197,6 @@ out_add_entry:
                entry = *(map_entries + j);
                kobject_put(&entry->kobj);
        }
-       if (map_kset)
-               kset_unregister(map_kset);
 out:
        return ret;
 }
index ddbce42548c9fb6c6e496b609c1fb05beb98c944..acf9a67f6770940170889b9bb058e88272396d9f 100644 (file)
@@ -121,7 +121,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
        int len, i;
        int err = -ENOMEM;
 
-       entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+       entry = kzalloc(sizeof(*entry), GFP_KERNEL);
        if (!entry)
                return err;