History

Merge tag 'efi-urgent-2021-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Ingo Molnar: - another missing RT_PROP table related fix, to ensure that the efivarfs pseudo filesystem fails gracefully if variable services are unsupported - use the correct alignment for literal EFI GUIDs - fix a use after unmap issue in the memreserve code * tag 'efi-urgent-2021-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi: use 32-bit alignment for efi_guid_t literals firmware/efi: Fix a use after bug in efi_mem_reserve_persistent efivars: respect EFI_UNSUPPORTED return from firmware

Linus Torvalds committed 5 years ago

Commit 92ed88c2 parents 5e3ddf9 429257a3 files · +10 −3Browse files

Unified · Split

3 files
  1. drivers/firmware/efi/efi.c +2 −1
  2. drivers/firmware/efi/vars.c +4 −0
  3. include/linux/efi.h +4 −2
drivers/firmware/efi/efi.c+2−1
@@ -927,7 +927,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 926 unmodified lines
927927 }
928928
929929 /* first try to find a slot in an existing linked list entry */
930− for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {
930+ for (prsv = efi_memreserve_root->next; prsv; ) {
931931 rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
932932 index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
933933 if (index < rsv->size) {
@@ -937,6 +937,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 3 unmodified lines
937937 memunmap(rsv);
938938 return efi_mem_reserve_iomem(addr, size);
939939 }
940+ prsv = rsv->next;
940941 memunmap(rsv);
941942 }
942943
drivers/firmware/efi/vars.c+4−0
@@ -484,6 +484,10 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), · 483 unmodified lines
484484 }
485485 }
486486
487+ break;
488+ case EFI_UNSUPPORTED:
489+ err = -EOPNOTSUPP;
490+ status = EFI_NOT_FOUND;
487491 break;
488492 case EFI_NOT_FOUND:
489493 break;
include/linux/efi.h+4−2
@@ -72,8 +72,10 @@ typedef void *efi_handle_t; · 71 unmodified lines
7272 */
7373 typedef guid_t efi_guid_t __aligned(__alignof__(u32));
7474
75−#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
76− GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
75+#define EFI_GUID(a, b, c, d...) (efi_guid_t){ { \
76+ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
77+ (b) & 0xff, ((b) >> 8) & 0xff, \
78+ (c) & 0xff, ((c) >> 8) & 0xff, d } }
7779
7880 /*
7981 * Generic EFI table header

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t