Commit a0880c33 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'efi-fixes-for-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI fixes from Ard Biesheuvel:

 - handle potential mremap() failure gracefully

 - don't reject EFI memory attributes table version 2

* tag 'efi-fixes-for-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
  efi: fix potential NULL deref in efi_mem_reserve_persistent
  efi: Accept version 2 of memory attributes table
parents a30df1ea 966d47e1
...@@ -1007,6 +1007,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) ...@@ -1007,6 +1007,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
/* first try to find a slot in an existing linked list entry */ /* first try to find a slot in an existing linked list entry */
for (prsv = efi_memreserve_root->next; prsv; ) { for (prsv = efi_memreserve_root->next; prsv; ) {
rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB); rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
if (!rsv)
return -ENOMEM;
index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size); index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
if (index < rsv->size) { if (index < rsv->size) {
rsv->entry[index].base = addr; rsv->entry[index].base = addr;
......
...@@ -33,7 +33,7 @@ int __init efi_memattr_init(void) ...@@ -33,7 +33,7 @@ int __init efi_memattr_init(void)
return -ENOMEM; return -ENOMEM;
} }
if (tbl->version > 1) { if (tbl->version > 2) {
pr_warn("Unexpected EFI Memory Attributes table version %d\n", pr_warn("Unexpected EFI Memory Attributes table version %d\n",
tbl->version); tbl->version);
goto unmap; goto unmap;
......
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