2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-24 21:24:00 +08:00

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>
This commit is contained in:
Eric Sandeen 2014-10-02 09:23:49 +10:00 committed by Dave Chinner
parent ce57bcf6b8
commit 6ee49a20c1

View File

@ -2563,6 +2563,7 @@ xfs_da_get_buf(
mapp, nmap, 0); mapp, nmap, 0);
error = bp ? bp->b_error : -EIO; error = bp ? bp->b_error : -EIO;
if (error) { if (error) {
if (bp)
xfs_trans_brelse(trans, bp); xfs_trans_brelse(trans, bp);
goto out_free; goto out_free;
} }