aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efivars.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware/efivars.c')
-rw-r--r--drivers/firmware/efivars.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 37ac21a08751..bee14cc47c03 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -784,7 +784,51 @@ static int efi_pstore_write(enum pstore_type_id type,
784static int efi_pstore_erase(enum pstore_type_id type, u64 id, 784static int efi_pstore_erase(enum pstore_type_id type, u64 id,
785 struct pstore_info *psi) 785 struct pstore_info *psi)
786{ 786{
787 efi_pstore_write(type, 0, &id, (unsigned int)id, 0, psi); 787 char stub_name[DUMP_NAME_LEN];
788 efi_char16_t efi_name[DUMP_NAME_LEN];
789 efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
790 struct efivars *efivars = psi->data;
791 struct efivar_entry *entry, *found = NULL;
792 int i;
793
794 sprintf(stub_name, "dump-type%u-%u-", type, (unsigned int)id);
795
796 spin_lock(&efivars->lock);
797
798 for (i = 0; i < DUMP_NAME_LEN; i++)
799 efi_name[i] = stub_name[i];
800
801 /*
802 * Clean up any entries with the same name
803 */
804
805 list_for_each_entry(entry, &efivars->list, list) {
806 get_var_data_locked(efivars, &entry->var);
807
808 if (efi_guidcmp(entry->var.VendorGuid, vendor))
809 continue;
810 if (utf16_strncmp(entry->var.VariableName, efi_name,
811 utf16_strlen(efi_name)))
812 continue;
813 /* Needs to be a prefix */
814 if (entry->var.VariableName[utf16_strlen(efi_name)] == 0)
815 continue;
816
817 /* found */
818 found = entry;
819 efivars->ops->set_variable(entry->var.VariableName,
820 &entry->var.VendorGuid,
821 PSTORE_EFI_ATTRIBUTES,
822 0, NULL);
823 }
824
825 if (found)
826 list_del(&found->list);
827
828 spin_unlock(&efivars->lock);
829
830 if (found)
831 efivar_unregister(found);
788 832
789 return 0; 833 return 0;
790} 834}