Commit dad2a28d authored by Shuxiao Zhang's avatar Shuxiao Zhang Committed by Sasha Levin

staging: android: ashmem: lseek failed due to no FMODE_LSEEK.

[ Upstream commit 97fbfef6 ]

vfs_llseek will check whether the file mode has
FMODE_LSEEK, no return failure. But ashmem can be
lseek, so add FMODE_LSEEK to ashmem file.

Comment From Greg Hackmann:
	ashmem_llseek() passes the llseek() call through to the backing
	shmem file.  91360b02 ("ashmem: use vfs_llseek()") changed
	this from directly calling the file's llseek() op into a VFS
	layer call.  This also adds a check for the FMODE_LSEEK bit, so
	without that bit ashmem_llseek() now always fails with -ESPIPE.

Fixes: 91360b02 ("ashmem: use vfs_llseek()")
Signed-off-by: default avatarShuxiao Zhang <zhangshuxiao@xiaomi.com>
Tested-by: default avatarGreg Hackmann <ghackmann@google.com>
Cc: stable <stable@vger.kernel.org> # 3.18+
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 4ac302f8
...@@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
ret = PTR_ERR(vmfile); ret = PTR_ERR(vmfile);
goto out; goto out;
} }
vmfile->f_mode |= FMODE_LSEEK;
asma->file = vmfile; asma->file = vmfile;
} }
get_file(asma->file); get_file(asma->file);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment