summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorEric Sandeen2014-10-02 01:23:49 +0200
committerDave Chinner2014-10-02 01:23:49 +0200
commit6ee49a20c13b4b4e79a3bba406df8106cff284a1 (patch)
tree07fd39c605fbfd6bb17fe348730d664b11c18fd2 /fs/xfs
parentxfs: check for inode size overflow in xfs_new_eof() (diff)
downloadkernel-qcow2-linux-6ee49a20c13b4b4e79a3bba406df8106cff284a1.tar.gz
kernel-qcow2-linux-6ee49a20c13b4b4e79a3bba406df8106cff284a1.tar.xz
kernel-qcow2-linux-6ee49a20c13b4b4e79a3bba406df8106cff284a1.zip
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 <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c3
1 files changed, 2 insertions, 1 deletions
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;
}