xfs: fix partially uninitialized structure in xfs_reflink_remap_extent
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 12 Apr 2020 20:11:11 +0000 (13:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2020 15:23:16 +0000 (17:23 +0200)
commit83693a553aed4eee4061c0a0f78f533731f60f71
tree4137e915a6818a428c70ef79f8ffbe098b0963f9
parent2cb2bcf81215cc770e7429a899e12563c24d9f2e
xfs: fix partially uninitialized structure in xfs_reflink_remap_extent

[ Upstream commit c142932c29e533ee892f87b44d8abc5719edceec ]

In the reflink extent remap function, it turns out that uirec (the block
mapping corresponding only to the part of the passed-in mapping that got
unmapped) was not fully initialized.  Specifically, br_state was not
being copied from the passed-in struct to the uirec.  This could lead to
unpredictable results such as the reflinked mapping being marked
unwritten in the destination file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/xfs_reflink.c