Commit c102cb09 authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'efi-urgent' of...

Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent

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: default avatarIngo Molnar <mingo@kernel.org>
parents de71ad2c d67e1996
...@@ -1109,6 +1109,8 @@ struct boot_params *make_boot_params(struct efi_config *c) ...@@ -1109,6 +1109,8 @@ struct boot_params *make_boot_params(struct efi_config *c)
if (!cmdline_ptr) if (!cmdline_ptr)
goto fail; goto fail;
hdr->cmd_line_ptr = (unsigned long)cmdline_ptr; 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_image = 0;
hdr->ramdisk_size = 0; hdr->ramdisk_size = 0;
......
...@@ -120,7 +120,8 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr) ...@@ -120,7 +120,8 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
entry = kzalloc(sizeof(*entry), GFP_KERNEL); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry) { if (!entry) {
kset_unregister(map_kset); kset_unregister(map_kset);
return entry; map_kset = NULL;
return ERR_PTR(-ENOMEM);
} }
memcpy(&entry->md, efi_runtime_map + nr * efi_memdesc_size, memcpy(&entry->md, efi_runtime_map + nr * efi_memdesc_size,
...@@ -132,6 +133,7 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr) ...@@ -132,6 +133,7 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
if (ret) { if (ret) {
kobject_put(&entry->kobj); kobject_put(&entry->kobj);
kset_unregister(map_kset); kset_unregister(map_kset);
map_kset = NULL;
return ERR_PTR(ret); return ERR_PTR(ret);
} }
...@@ -195,8 +197,6 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj) ...@@ -195,8 +197,6 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj)
entry = *(map_entries + j); entry = *(map_entries + j);
kobject_put(&entry->kobj); kobject_put(&entry->kobj);
} }
if (map_kset)
kset_unregister(map_kset);
out: out:
return ret; return ret;
} }
...@@ -121,7 +121,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, ...@@ -121,7 +121,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
int len, i; int len, i;
int err = -ENOMEM; int err = -ENOMEM;
entry = kmalloc(sizeof(*entry), GFP_KERNEL); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry) if (!entry)
return err; return err;
......
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