staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
authorzhangshuxiao <zhangshuxiao@xiaomi.com>
Wed, 8 Mar 2017 08:53:24 +0000 (16:53 +0800)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 10 Apr 2017 14:10:04 +0000 (16:10 +0200)
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.

Change-Id: Ia78ef4c7c96adb89d52e70b63f7c00636fe60d01
Signed-off-by: zhangshuxiao <zhangshuxiao@xiaomi.com>
(cherry picked from commit 6c8d409129bbebe36cde9f8e511011756216163a)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/android/ashmem.c

index 3a52b29..9435dc5 100644 (file)
@@ -405,6 +405,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
                        ret = PTR_ERR(vmfile);
                        goto out;
                }
+               vmfile->f_mode |= FMODE_LSEEK;
                asma->file = vmfile;
        }
        get_file(asma->file);