[PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one
Darrick J. Wong
darrick.wong at oracle.com
Mon Jan 4 19:28:32 CST 2016
On Sun, Jan 03, 2016 at 01:07:52PM +0100, Christoph Hellwig wrote:
> Without these we can see NULL pointer dereferences due to a non-existing
> COW fork during xfstests runs.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> fs/xfs/xfs_bmap_util.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 7bee3c7..e777095 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1226,13 +1226,15 @@ xfs_zero_remaining_bytes(
>
> error = xfs_bwrite(bp);
> xfs_buf_relse(bp);
> - if (error) {
> - err2 = xfs_reflink_end_cow_failed(ip, offset,
> + if (should_fork) {
> + if (error) {
> + err2 = xfs_reflink_end_cow_failed(ip, offset,
> + lastoffset - offset + 1);
> + return error;
> + }
> + error = xfs_reflink_end_cow(ip, offset,
> lastoffset - offset + 1);
> - return error;
> }
Good catch! There's a buffer leak in the error case for xfs_map_cow_blocks()
so I'll fold them both into the original patch.
--D
> - error = xfs_reflink_end_cow(ip, offset,
> - lastoffset - offset + 1);
> if (error)
> return error;
> }
> --
> 1.9.1
>
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
More information about the xfs
mailing list