diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2013-05-22 10:58:57 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-05-22 10:58:57 -0700 |
commit | 3979fdce77e6c2de97fa6c6f844ee76f001f4371 (patch) | |
tree | c5e2a223fdc8d82595b8cdf4471d7c0589078e7d /fs | |
parent | fbe06b7bae7c9cf6ab05168fce5ee93b2f4bae7c (diff) | |
parent | eccaf52fee8305d5207ff110950a82c100e459bc (diff) | |
download | linux-3979fdce77e6c2de97fa6c6f844ee76f001f4371.tar.gz linux-3979fdce77e6c2de97fa6c6f844ee76f001f4371.tar.bz2 linux-3979fdce77e6c2de97fa6c6f844ee76f001f4371.zip |
Merge tag 'efi-urgent' into x86/urgent
* Avoid confusing the user by returning -EIO instead of -ENOENT in
efivarfs if an EFI variable gets deleted from under us and return EOF
when reading from a zero-length file - Lingzhu Xiang
* Fix an oops in efivar_update_sysfs_entries() caused by reusing (and
therefore corrupting) a kzalloc() allocation - Seiji Aguchi
* Initialise the DataSize argument to GetVariable() otherwise it will
not be updated with the actual size of the variable on return.
Discovered on a Acer Aspire V3 BIOS - Lee, Chun-Yi
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/efivarfs/file.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index bfb531564319..8dd524f32284 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c @@ -44,8 +44,11 @@ static ssize_t efivarfs_file_write(struct file *file, bytes = efivar_entry_set_get_size(var, attributes, &datasize, data, &set); - if (!set && bytes) + if (!set && bytes) { + if (bytes == -ENOENT) + bytes = -EIO; goto out; + } if (bytes == -ENOENT) { drop_nlink(inode); @@ -76,7 +79,14 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, int err; err = efivar_entry_size(var, &datasize); - if (err) + + /* + * efivarfs represents uncommitted variables with + * zero-length files. Reading them should return EOF. + */ + if (err == -ENOENT) + return 0; + else if (err) return err; data = kmalloc(datasize + sizeof(attributes), GFP_KERNEL); |