* 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) iQIcBAABAgAGBQJRlgJ5AAoJEC84WcCNIz1VcRgQAJWnQpuI+Y1RjPYuLb8ISZ92 jKnVSAQPaWDccf/KKx7qtk2iK6G1mExomOggp6PpV4/uHWqkQ64qoGL0HmRbmdH7 //gNXm+ITnSVojoTBBis2LYEYDUQ1aDp3vTevFT2OOMKzKRsgwFD5KbqLnPJCxnl kFHlxQSPa7ZYk6GXOVdBJ5ya7spU+Lk4ODiL4xM8EBkMBedUStedB5zNg5rEMLJq 5FZfs2Ryg7riOkhBnKWCvFjAj3PO/yHLVdrVrGZx+KpATHr/rbsbzDEp3+Pk8zEu 3aE1p/XLaB4Qk9WvwhWonWF7PSZP41SjrcEt77mTmYivk0cJHBORo/wJsom683BU 4elWR588Pi92nKEx4MSLREhkzP5RdVFIb4Yrg+1xKLEfI5Kfj1nEQrFVk53VM/rL L1m1bwhKLaNUVFJmxJYHaZ6VTjcB6lupz9/AMQr1N1UAavlmr4xEveNTfto+Ys7u /J3Z04wouhOGQonVDrZxxOzWFewq1kR/hRfwBAf/V0qemAeS61ZHGpfmmq00y5L2 jmXncQ5EspFIJfk7+KV2sPQfqC8U8b2jyfO36Ed9u3d/qQ6eiQ1rTZMLKGg1iSdW Z+94w7+huEdsNZShSUE8+HXNvzPCS6704PBa9YT292ZibWM9onk6AoBQy/snrEaO K+PKxkZyPBML77Vs4TSI =8+a3 -----END PGP SIGNATURE----- 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>
This commit is contained in:
Коммит
3979fdce77
|
@ -206,7 +206,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
|
|||
}
|
||||
|
||||
if (boot_used_size && !finished) {
|
||||
unsigned long size;
|
||||
unsigned long size = 0;
|
||||
u32 attr;
|
||||
efi_status_t s;
|
||||
void *tmp;
|
||||
|
|
|
@ -523,13 +523,11 @@ static void efivar_update_sysfs_entries(struct work_struct *work)
|
|||
struct efivar_entry *entry;
|
||||
int err;
|
||||
|
||||
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
/* Add new sysfs entries */
|
||||
while (1) {
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
err = efivar_init(efivar_update_sysfs_entry, entry,
|
||||
true, false, &efivar_sysfs_list);
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче