From: Eric Sandeen Date: Wed, 1 Oct 2014 23:23:49 +0000 (+1000) Subject: xfs: don't send null bp to xfs_trans_brelse() X-Git-Tag: v3.18-rc1~75^2^2~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6ee49a20c13b4b4e79a3bba406df8106cff284a1;p=karo-tx-linux.git xfs: don't send null bp to xfs_trans_brelse() In this case, if bp is NULL, error is set, and we send a NULL bp to xfs_trans_brelse, which will try to dereference it. Test whether we actually have a buffer before we try to free it. Coverity spotted this. Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig Signed-off-by: Dave Chinner --- diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index 2c42ae28d027..fd827530afec 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -2563,7 +2563,8 @@ xfs_da_get_buf( mapp, nmap, 0); error = bp ? bp->b_error : -EIO; if (error) { - xfs_trans_brelse(trans, bp); + if (bp) + xfs_trans_brelse(trans, bp); goto out_free; }