Re: [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
> ---
>  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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux