mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
UPSTREAM: ANDROID: fuse-bpf: Fix the issue of abnormal lseek system calls
fuse_lseek_backing was returning the offset as an int, which would then be treated as an ERR if in the range 4G-4096 and 4G. Although the call would appear to work correctly, the file position would be incorrect according to a subsequent fseek with SEEK_CUR. Based on a change by chenyuwen <chenyuwen1@meizu.com> who found and fixed this issue. Bug: 319219307 Change-Id: I3aef5fb22751a72ce2bd7674ee081956a89fc752 Signed-off-by: chenyuwen <chenyuwen1@meizu.com> Signed-off-by: Paul Lawrence <paullawrence@google.com>
This commit is contained in:
parent
aeeb2c9cb3
commit
84ab1889e1
1 changed files with 7 additions and 4 deletions
|
|
@ -454,23 +454,26 @@ int fuse_lseek_backing(struct fuse_bpf_args *fa, struct file *file, loff_t offse
|
|||
struct file *backing_file = fuse_file->backing_file;
|
||||
loff_t ret;
|
||||
|
||||
/* TODO: Handle changing of the file handle */
|
||||
if (offset == 0) {
|
||||
if (whence == SEEK_CUR) {
|
||||
flo->offset = file->f_pos;
|
||||
return flo->offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (whence == SEEK_SET) {
|
||||
flo->offset = vfs_setpos(file, 0, 0);
|
||||
return flo->offset;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inode_lock(file->f_inode);
|
||||
backing_file->f_pos = file->f_pos;
|
||||
ret = vfs_llseek(backing_file, fli->offset, fli->whence);
|
||||
flo->offset = ret;
|
||||
|
||||
if (!IS_ERR(ERR_PTR(ret))) {
|
||||
flo->offset = ret;
|
||||
ret = 0;
|
||||
}
|
||||
inode_unlock(file->f_inode);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue