Skip to content

Commit

Permalink
Merge tag 'efi-fixes-for-v6.2-3' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/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
  • Loading branch information
torvalds committed Feb 3, 2023
2 parents a30df1e + 966d47e commit a0880c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions drivers/firmware/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
for (prsv = efi_memreserve_root->next; prsv; ) {
rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
if (!rsv)
return -ENOMEM;
index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
if (index < rsv->size) {
rsv->entry[index].base = addr;
Expand Down
2 changes: 1 addition & 1 deletion drivers/firmware/efi/memattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int __init efi_memattr_init(void)
return -ENOMEM;
}

if (tbl->version > 1) {
if (tbl->version > 2) {
pr_warn("Unexpected EFI Memory Attributes table version %d\n",
tbl->version);
goto unmap;
Expand Down

0 comments on commit a0880c3

Please sign in to comment.