xfs
[Top] [All Lists]

Re: [PATCH 1/2] libxfs: don't send null bp to xfs_trans_brelse()

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH 1/2] libxfs: don't send null bp to xfs_trans_brelse()
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Tue, 17 Jun 2014 11:04:59 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1402960461-27881-2-git-send-email-sandeen@xxxxxxxxxx>
References: <1402960461-27881-1-git-send-email-sandeen@xxxxxxxxxx> <1402960461-27881-2-git-send-email-sandeen@xxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Mon, Jun 16, 2014 at 06:14:20PM -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.
> 
> Same fix as was sent for kernelspace.
> 
> Coverity spotted this.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  libxfs/xfs_da_btree.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c
> index b70454e..b731b54 100644
> --- a/libxfs/xfs_da_btree.c
> +++ b/libxfs/xfs_da_btree.c
> @@ -2582,7 +2582,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;
>       }
>  
> -- 
> 1.7.1
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

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