]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
efivarfs: Never return ENOENT from firmware
authorMatt Fleming <matt.fleming@intel.com>
Wed, 16 Jan 2013 13:47:05 +0000 (13:47 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Fri, 18 Jan 2013 09:43:44 +0000 (09:43 +0000)
Files are created in efivarfs_create() before a corresponding variable
is created in the firmware. This leads to users being able to
read/write to the file without the variable existing in the
firmware. Reading a non-existent variable currently returns -ENOENT,
which is confusing because the file obviously *does* exist.

Convert EFI_NOT_FOUND into -EIO which is the closest thing to "error
while interacting with firmware", and should hopefully indicate to the
caller that the variable is in some uninitialised state.

Cc: Josh Boyer <jwboyer@redhat.com>
Acked-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: Lee, Chun-Yi <jlee@suse.com>
Cc: Andy Whitcroft <apw@canonical.com>
Reported-by: Lingzhu Xiang <lxiang@redhat.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
drivers/firmware/efivars.c

index fa9fa038de3f8161adc095cee2bc997f99da4068..807dad48b2b14d8257996791c8e7ff767c3bcc5e 100644 (file)
@@ -674,7 +674,7 @@ static int efi_status_to_err(efi_status_t status)
                err = -EACCES;
                break;
        case EFI_NOT_FOUND:
-               err = -ENOENT;
+               err = -EIO;
                break;
        default:
                err = -EINVAL;