From: Eric Sandeen Date: Thu, 19 Jun 2014 02:15:06 +0000 (+1000) Subject: libxfs: don't send null bp to xfs_trans_brelse() X-Git-Tag: v3.2.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35f2764a85e182de9eafe183c80660ed5f9d932b;p=thirdparty%2Fxfsprogs-dev.git libxfs: don't send null bp to xfs_trans_brelse() 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 Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index b70454ee2..b731b5451 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; }