Skip to content

Commit

Permalink
ovl: fix lseek overflow on 32bit
Browse files Browse the repository at this point in the history
ovl_lseek() is using ssize_t to return the value from vfs_llseek().  On a
32-bit kernel ssize_t is a 32-bit signed int, which overflows above 2 GB.

Assign the return value of vfs_llseek() to loff_t to fix this.

Reported-by: Boris Gjenero <boris.gjenero@gmail.com>
Fixes: 9e46b84 ("ovl: support stacked SEEK_HOLE/SEEK_DATA")
Cc: <stable@vger.kernel.org> # v4.19
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Feb 3, 2020
1 parent 1a980b8 commit a4ac9d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/overlayfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static loff_t ovl_llseek(struct file *file, loff_t offset, int whence)
struct inode *inode = file_inode(file);
struct fd real;
const struct cred *old_cred;
ssize_t ret;
loff_t ret;

/*
* The two special cases below do not need to involve real fs,
Expand Down

0 comments on commit a4ac9d4

Please sign in to comment.