]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
create_inode: fix copying large files
authorRoss Burton <ross.burton@intel.com>
Thu, 7 Feb 2019 16:05:13 +0000 (11:05 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 7 Feb 2019 16:05:25 +0000 (11:05 -0500)
commit1eec7413677ee15182470928c7236969d32d8426
treee63907212b0c553b63ba3686d439da08301453c7
parent453a2f6175ff29534aa3cf7da5a0bff05792dd6b
create_inode: fix copying large files

When copying large files into a ext filesystem at mkfs time the copy
fails at 2^31 bytes in.  There are two problems:

copy_file_chunk() passes an offset (off_t, 64-bit typically) to
ext2fs_file_lseek() which expects a ext2_off_t (typedef to __u32) so
the value is truncated. Solve by calling ext2fs_file_llseek() which
takes a u64 offset instead.

try_lseek_copy() rounds the data and hole offsets as found by lseek()
to block boundaries, but the calculation gets truncated to 32-bits.
Solve by casting the 32-bit blocksize to off_t to ensure this doesn't
happen.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
misc/create_inode.c