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
Unified · Split
| @@ -927,7 +927,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 926 unmodified lines | ||
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | /* 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; ) { | |
| 931 | 931 | rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB); |
| 932 | 932 | index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size); |
| 933 | 933 | if (index < rsv->size) { |
| @@ -937,6 +937,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 3 unmodified lines | ||
| 937 | 937 | memunmap(rsv); |
| 938 | 938 | return efi_mem_reserve_iomem(addr, size); |
| 939 | 939 | } |
| 940 | + prsv = rsv->next; | |
| 940 | 941 | memunmap(rsv); |
| 941 | 942 | } |
| 942 | 943 | |
| @@ -484,6 +484,10 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), · 483 unmodified lines | ||
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | + break; | |
| 488 | + case EFI_UNSUPPORTED: | |
| 489 | + err = -EOPNOTSUPP; | |
| 490 | + status = EFI_NOT_FOUND; | |
| 487 | 491 | break; |
| 488 | 492 | case EFI_NOT_FOUND: |
| 489 | 493 | break; |
| @@ -72,8 +72,10 @@ typedef void *efi_handle_t; · 71 unmodified lines | ||
| 72 | 72 | */ |
| 73 | 73 | typedef guid_t efi_guid_t __aligned(__alignof__(u32)); |
| 74 | 74 | |
| 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 } } | |
| 77 | 79 | |
| 78 | 80 | /* |
| 79 | 81 | * Generic EFI table header |