Re: [PATCH AUTOSEL 6.6 07/35] efi: pstore: Return proper errors on UEFI failures

Ard Biesheuvel
2024-06-17T13:24:54Z

NAK

This is not a bugfix so it does not belong in stable.

On Mon, 17 Jun 2024 at 15:23, Sasha Levin <sashal@kernel.org> wrote:
>
> From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
>
> [ Upstream commit 7c23b186ab892088f76a3ad9dbff1685ffe2e832 ]
>
> 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>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> drivers/firmware/efi/efi-pstore.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
> index e7b9ec6f8a86a..5669023bdd1de 100644
> --- a/drivers/firmware/efi/efi-pstore.c
> +++ b/drivers/firmware/efi/efi-pstore.c
> @@ -109,7 +109,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);
> }
>
> /*
> @@ -154,7 +154,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))
> @@ -192,7 +192,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)
> @@ -203,7 +203,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;
> }
>
> --
> 2.43.0
>