diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/platform/efi/efi.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 4f364c7c6111..e4a86a677ce1 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -113,6 +113,15 @@ static int __init setup_add_efi_memmap(char *arg) | |||
113 | } | 113 | } |
114 | early_param("add_efi_memmap", setup_add_efi_memmap); | 114 | early_param("add_efi_memmap", setup_add_efi_memmap); |
115 | 115 | ||
116 | static bool efi_no_storage_paranoia; | ||
117 | |||
118 | static int __init setup_storage_paranoia(char *arg) | ||
119 | { | ||
120 | efi_no_storage_paranoia = true; | ||
121 | return 0; | ||
122 | } | ||
123 | early_param("efi_no_storage_paranoia", setup_storage_paranoia); | ||
124 | |||
116 | 125 | ||
117 | static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | 126 | static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) |
118 | { | 127 | { |
@@ -1137,7 +1146,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) | |||
1137 | */ | 1146 | */ |
1138 | 1147 | ||
1139 | if (!storage_size || size > remaining_size || | 1148 | if (!storage_size || size > remaining_size || |
1140 | (max_size && size > max_size) || | 1149 | (max_size && size > max_size)) |
1150 | return EFI_OUT_OF_RESOURCES; | ||
1151 | |||
1152 | if (!efi_no_storage_paranoia && | ||
1141 | ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) && | 1153 | ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) && |
1142 | (remaining_size - size < storage_size / 2))) | 1154 | (remaining_size - size < storage_size / 2))) |
1143 | return EFI_OUT_OF_RESOURCES; | 1155 | return EFI_OUT_OF_RESOURCES; |