xfs
[Top] [All Lists]

Re: [PATCH] xfs: don't send null bp to xfs_trans_brelse()

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfs: don't send null bp to xfs_trans_brelse()
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Thu, 12 Jun 2014 11:00:01 -0400
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <53978301.3050105@xxxxxxxxxx>
References: <53978301.3050105@xxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Tue, Jun 10, 2014 at 05:13:21PM -0500, Eric Sandeen wrote:
> In this case, if bp is null, error is set, and we send
> bp to xfs_trans_brelse, which will try to dereference it.
> 
> Test whether we actualy have a buffer before we try to
> free it.
> 
> Coverity spotted this.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

> 
> diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
> index 6cc5f67..41f7a42 100644
> --- a/fs/xfs/xfs_da_btree.c
> +++ b/fs/xfs/xfs_da_btree.c
> @@ -2571,7 +2571,8 @@ xfs_da_get_buf(
>                                   mapp, nmap, 0);
>       error = bp ? bp->b_error : XFS_ERROR(EIO);
>       if (error) {
> -             xfs_trans_brelse(trans, bp);
> +             if (bp)
> +                     xfs_trans_brelse(trans, bp);
>               goto out_free;
>       }
>  
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>