summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilherme G. Piccoli <gpiccoli@igalia.com>2024-05-19 18:33:53 +0200
committerArd Biesheuvel <ardb@kernel.org>2024-05-23 09:09:39 +0200
commit7c23b186ab892088f76a3ad9dbff1685ffe2e832 (patch)
tree0a4a7a8621786261873210e4bff4802b6547147e
parentefi/libstub: zboot.lds: Discard .discard sections (diff)
downloadlinux-7c23b186ab892088f76a3ad9dbff1685ffe2e832.tar.xz
linux-7c23b186ab892088f76a3ad9dbff1685ffe2e832.zip
efi: pstore: Return proper errors on UEFI failures
Right now efi-pstore either returns 0 (success) or -EIO; but we do have a function to convert UEFI errors in different standard error codes, helping to narrow down potential issues more accurately. So, let's use this helper here. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r--drivers/firmware/efi/efi-pstore.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 5b9dc26e6bcb..552c78f5f059 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -136,7 +136,7 @@ static int efi_pstore_read_func(struct pstore_record *record,
&size, record->buf);
if (status != EFI_SUCCESS) {
kfree(record->buf);
- return -EIO;
+ return efi_status_to_err(status);
}
/*
@@ -189,7 +189,7 @@ static ssize_t efi_pstore_read(struct pstore_record *record)
return 0;
if (status != EFI_SUCCESS)
- return -EIO;
+ return efi_status_to_err(status);
/* skip variables that don't concern us */
if (efi_guidcmp(guid, LINUX_EFI_CRASH_GUID))
@@ -227,7 +227,7 @@ static int efi_pstore_write(struct pstore_record *record)
record->size, record->psi->buf,
true);
efivar_unlock();
- return status == EFI_SUCCESS ? 0 : -EIO;
+ return efi_status_to_err(status);
};
static int efi_pstore_erase(struct pstore_record *record)
@@ -238,7 +238,7 @@ static int efi_pstore_erase(struct pstore_record *record)
PSTORE_EFI_ATTRIBUTES, 0, NULL);
if (status != EFI_SUCCESS && status != EFI_NOT_FOUND)
- return -EIO;
+ return efi_status_to_err(status);
return 0;
}