Re: [PATCH] xfs: don't call xfs_da_shrink_inode with NULL bp

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

 



On Fri, Jun 08, 2018 at 11:52:13AM -0500, Eric Sandeen wrote:
> xfs_attr3_leaf_create may have errored out before instantiating a buffer,
> for example if the blkno is out of range.  In that case there is no work 
> to do to remove it, and in fact xfs_da_shrink_inode will lead to an oops
> if we try.
> 
> This also seems to fix a flaw where the original error from
> xfs_attr3_leaf_create gets overwritten in the cleanup case, and it
> removes a pointless assignment to bp which isn't used after this.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199969
> Reported-by: Xu, Wen <wen.xu@xxxxxxxxxx>
> Tested-by: Xu, Wen <wen.xu@xxxxxxxxxx>
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>

> 
> NB: I've not regression tested this yet, just going on the reporter's
> positive test result.
> 
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index 2135b8e..397699d 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -803,9 +803,8 @@ STATIC void xfs_attr3_leaf_moveents(struct xfs_da_args *args,
>  	ASSERT(blkno == 0);
>  	error = xfs_attr3_leaf_create(args, blkno, &bp);
>  	if (error) {
> -		error = xfs_da_shrink_inode(args, 0, bp);
> -		bp = NULL;
> -		if (error)
> +		/* xfs_attr3_leaf_create may not have instantiated a block */
> +		if (bp && (xfs_da_shrink_inode(args, 0, bp) != 0))
>  			goto out;
>  		xfs_idata_realloc(dp, size, XFS_ATTR_FORK);	/* try to put */
>  		memcpy(ifp->if_u1.if_data, tmpbuffer, size);	/* it back */
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Carlos
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux