]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ext4: fix offset overflow on 32-bit archs in ext4_iomap_begin()
authorJiri Slaby <jslaby@suse.cz>
Thu, 22 Mar 2018 15:50:26 +0000 (11:50 -0400)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 15:50:02 +0000 (11:50 -0400)
commit6d54235b33cadd220fa3e521d6a4a0e3b69db88f
tree073bf068451e57beb8358e8c0568ee6e1276b9be
parentfb64b04724660f1ebb533f0d92c076eff70ccfb2
ext4: fix offset overflow on 32-bit archs in ext4_iomap_begin()

BugLink: http://bugs.launchpad.net/bugs/1773233
commit fe23cb65c2c394ea306f3714a17d46ab2e6a0af1 upstream.

ext4_iomap_begin() has a bug where offset returned in the iomap
structure will be truncated to unsigned long size. On 64-bit
architectures this is fine but on 32-bit architectures obviously not.
Not many places actually use the offset stored in the iomap structure
but one of visible failures is in SEEK_HOLE / SEEK_DATA implementation.
If we create a file like:

dd if=/dev/urandom of=file bs=1k seek=8m count=1

then

lseek64("file", 0x100000000ULL, SEEK_DATA)

wrongly returns 0x100000000 on unfixed kernel while it should return
0x200000000. Avoid the overflow by proper type cast.

Fixes: 545052e9e35a ("ext4: Switch to iomap for SEEK_HOLE / SEEK_DATA")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org # v4.15
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/ext4/inode.c