]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.61/staging-android-ashmem-lseek-failed-due-to-no-fmode_lseek.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.4.61 / staging-android-ashmem-lseek-failed-due-to-no-fmode_lseek.patch
CommitLineData
f99637f6
GKH
1From 97fbfef6bd597888485b653175fb846c6998b60c Mon Sep 17 00:00:00 2001
2From: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
3Date: Thu, 6 Apr 2017 22:30:29 +0800
4Subject: staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
5
6From: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
7
8commit 97fbfef6bd597888485b653175fb846c6998b60c upstream.
9
10vfs_llseek will check whether the file mode has
11FMODE_LSEEK, no return failure. But ashmem can be
12lseek, so add FMODE_LSEEK to ashmem file.
13
14Comment From Greg Hackmann:
15 ashmem_llseek() passes the llseek() call through to the backing
16 shmem file. 91360b02ab48 ("ashmem: use vfs_llseek()") changed
17 this from directly calling the file's llseek() op into a VFS
18 layer call. This also adds a check for the FMODE_LSEEK bit, so
19 without that bit ashmem_llseek() now always fails with -ESPIPE.
20
21Fixes: 91360b02ab48 ("ashmem: use vfs_llseek()")
22Signed-off-by: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
23Tested-by: Greg Hackmann <ghackmann@google.com>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26---
27 drivers/staging/android/ashmem.c | 1 +
28 1 file changed, 1 insertion(+)
29
30--- a/drivers/staging/android/ashmem.c
31+++ b/drivers/staging/android/ashmem.c
32@@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file
33 ret = PTR_ERR(vmfile);
34 goto out;
35 }
36+ vmfile->f_mode |= FMODE_LSEEK;
37 asma->file = vmfile;
38 }
39 get_file(asma->file);