]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ovl: fix lseek overflow on 32bit
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 3 Feb 2020 10:41:53 +0000 (11:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:36:55 +0000 (04:36 -0800)
commit a4ac9d45c0cd14a2adc872186431c79804b77dbf upstream.

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: 9e46b840c705 ("ovl: support stacked SEEK_HOLE/SEEK_DATA")
Cc: <stable@vger.kernel.org> # v4.19
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/overlayfs/file.c

index e235a635d9ec7eb90c83ce3eab4e4eeb7631a961..15e4fa288475bc34a11f1db63074655babe389bc 100644 (file)
@@ -146,7 +146,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,