]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
efivarfs: Ensure VariableName is NUL-terminated
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Thu, 2 Apr 2015 07:39:00 +0000 (08:39 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Wed, 20 May 2015 12:25:55 +0000 (13:25 +0100)
commit c57dcb566d3d866a302a1da2e06344bec31d5bcd upstream.

Some buggy firmware implementations update VariableNameSize on success
such that it does not include the final NUL character which results in
garbage in the efivarfs name entries.  Use kzalloc on the efivar_entry
(as is done in efivars.c) to ensure that the name is always
NUL-terminated.

The buggy firmware is:
BIOS Information
        Vendor: Intel Corp.
        Version: S1200RP.86B.02.02.0005.102320140911
        Release Date: 10/23/2014
        BIOS Revision: 4.6
System Information
        Manufacturer: Intel Corporation
        Product Name: S1200RP_SE

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Matthew Garrett <mjg59@coreos.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
fs/efivarfs/super.c

index 0a48886e069cda3b1a309ef077a4e6dcc79490bb..c2f421c30ccdf9b92375273414cc3fa206428fd8 100644 (file)
@@ -121,7 +121,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
        int len, i;
        int err = -ENOMEM;
 
-       entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+       entry = kzalloc(sizeof(*entry), GFP_KERNEL);
        if (!entry)
                return err;