WSL2-Linux-Kernel/tools
Matt Fleming 123abd76ed efivars: efivarfs_valid_name() should handle pstore syntax
Stricter validation was introduced with commit da27a24383
("efivarfs: guid part of filenames are case-insensitive") and commit
47f531e8ba ("efivarfs: Validate filenames much more aggressively"),
which is necessary for the guid portion of efivarfs filenames, but we
don't need to be so strict with the first part, the variable name. The
UEFI specification doesn't impose any constraints on variable names
other than they be a NULL-terminated string.

The above commits caused a regression that resulted in users seeing
the following message,

  $ sudo mount -v /sys/firmware/efi/efivars mount: Cannot allocate memory

whenever pstore EFI variables were present in the variable store,
since their variable names failed to pass the following check,

    /* GUID should be right after the first '-' */
    if (s - 1 != strchr(str, '-'))

as a typical pstore filename is of the form, dump-type0-10-1-<guid>.
The fix is trivial since the guid portion of the filename is GUID_LEN
bytes, we can use (len - GUID_LEN) to ensure the '-' character is
where we expect it to be.

(The bogus ENOMEM error value will be fixed in a separate patch.)

Reported-by: Joseph Yasi <joe.yasi@gmail.com>
Tested-by: Joseph Yasi <joe.yasi@gmail.com>
Reported-by: Lingzhu Xiang <lxiang@redhat.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: <stable@vger.kernel.org> # v3.8
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-03-06 14:46:04 +00:00
..
cgroup cgroups: fix cgroup_event_listener error handling 2013-01-08 10:00:44 -08:00
firewire tools/firewire: nosy-dump: check for allocation failure 2012-12-02 20:10:18 +01:00
hv tools: hv: Use CLOEXEC when opening kvp_pool files 2013-01-18 16:03:34 -08:00
include/tools tools/include: Add byteshift headers for endian access 2012-02-28 10:22:51 -08:00
lguest tools/lguest: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:40:03 -08:00
lib/traceevent tools lib traceevent: Handle dynamic array's element size properly 2013-01-25 12:49:28 -03:00
nfsd NFSD: Added fault injection script 2011-11-07 21:10:47 -05:00
perf ImgTec Meta architecture changes for v3.9-rc1 2013-03-03 12:06:09 -08:00
power Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2013-02-18 22:34:11 +01:00
scripts tools: Pass the target in descend 2012-11-19 22:10:36 +00:00
testing efivars: efivarfs_valid_name() should handle pstore syntax 2013-03-06 14:46:04 +00:00
usb testusb: remove all mentions of 'usbfs' 2013-02-08 12:15:24 -08:00
virtio Some nice cleanups, and even a patch my wife did as a "live" demo for 2012-12-20 08:37:05 -08:00
vm tools/vm: add .gitignore to ignore built binaries 2013-02-05 20:38:46 +11:00
Makefile Merge branch 'for-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup 2013-02-20 09:16:21 -08:00