]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
libxfs: fix data corruption bug in libxfs_file_write
authorDarrick J. Wong <djwong@kernel.org>
Mon, 2 Mar 2026 20:55:34 +0000 (12:55 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 10 Mar 2026 03:34:29 +0000 (20:34 -0700)
commit2c9b0236b0d81d2ef1ce234750cc5453026f14b2
tree0cba5c9be29f8f24d4329c51323e1eb15f881cbf
parent39c683bf82ae26ee48dd9e148cbfecbc9d9c295e
libxfs: fix data corruption bug in libxfs_file_write

libxfs_file_write tries to initialize the entire file block buffer,
which includes zeroing the head portion if @pos is not aligned to the
filesystem block size.  However, @buf is the file data to copy in at
position @pos, not the position of the file block.  Therefore, block_off
should be added to b_addr, not buf.

Cc: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: 73fb78e5ee8940 ("mkfs: support copying in large or sparse files")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/util.c