Skip to content

Commit c142932

Browse files
committed
xfs: fix partially uninitialized structure in xfs_reflink_remap_extent
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 <[email protected]> Reviewed-by: Brian Foster <[email protected]>
1 parent 4b674b9 commit c142932

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/xfs/xfs_reflink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ xfs_reflink_remap_extent(
10511051
uirec.br_startblock = irec->br_startblock + rlen;
10521052
uirec.br_startoff = irec->br_startoff + rlen;
10531053
uirec.br_blockcount = unmap_len - rlen;
1054+
uirec.br_state = irec->br_state;
10541055
unmap_len = rlen;
10551056

10561057
/* If this isn't a real mapping, we're done. */

0 commit comments

Comments
 (0)