]>
Commit | Line | Data |
---|---|---|
f99637f6 GKH |
1 | From 97fbfef6bd597888485b653175fb846c6998b60c Mon Sep 17 00:00:00 2001 |
2 | From: Shuxiao Zhang <zhangshuxiao@xiaomi.com> | |
3 | Date: Thu, 6 Apr 2017 22:30:29 +0800 | |
4 | Subject: staging: android: ashmem: lseek failed due to no FMODE_LSEEK. | |
5 | ||
6 | From: Shuxiao Zhang <zhangshuxiao@xiaomi.com> | |
7 | ||
8 | commit 97fbfef6bd597888485b653175fb846c6998b60c upstream. | |
9 | ||
10 | vfs_llseek will check whether the file mode has | |
11 | FMODE_LSEEK, no return failure. But ashmem can be | |
12 | lseek, so add FMODE_LSEEK to ashmem file. | |
13 | ||
14 | Comment 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 | ||
21 | Fixes: 91360b02ab48 ("ashmem: use vfs_llseek()") | |
22 | Signed-off-by: Shuxiao Zhang <zhangshuxiao@xiaomi.com> | |
23 | Tested-by: Greg Hackmann <ghackmann@google.com> | |
24 | Signed-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); |