--- zzzz-none-000/linux-3.10.107/fs/efivarfs/file.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/fs/efivarfs/file.c 2021-02-04 17:41:59.000000000 +0000 @@ -22,7 +22,7 @@ u32 attributes; struct inode *inode = file->f_mapping->host; unsigned long datasize = count - sizeof(attributes); - ssize_t bytes = 0; + ssize_t bytes; bool set = false; if (count < sizeof(attributes)) @@ -34,14 +34,9 @@ if (attributes & ~(EFI_VARIABLE_MASK)) return -EINVAL; - data = kmalloc(datasize, GFP_KERNEL); - if (!data) - return -ENOMEM; - - if (copy_from_user(data, userbuf + sizeof(attributes), datasize)) { - bytes = -EFAULT; - goto out; - } + data = memdup_user(userbuf + sizeof(attributes), datasize); + if (IS_ERR(data)) + return PTR_ERR(data); bytes = efivar_entry_set_get_size(var, attributes, &datasize, data, &set); @@ -53,8 +48,8 @@ if (bytes == -ENOENT) { drop_nlink(inode); - d_delete(file->f_dentry); - dput(file->f_dentry); + d_delete(file->f_path.dentry); + dput(file->f_path.dentry); } else { mutex_lock(&inode->i_mutex); i_size_write(inode, datasize + sizeof(attributes)); @@ -154,8 +149,7 @@ return error; mutex_lock(&inode->i_mutex); - inode->i_flags &= ~S_IMMUTABLE; - inode->i_flags |= i_flags; + inode_set_flags(inode, i_flags, S_IMMUTABLE); mutex_unlock(&inode->i_mutex); mnt_drop_write_file(file);