diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-07-17 23:30:57 +0200 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-07-20 23:42:33 +0200 |
commit | 10479e2dea83d4c421ad05dfc55d918aa8dfc0cd (patch) | |
tree | 65bd2a8994345c5b793541206f54a15bf56903a9 /fs/xfs/libxfs/xfs_refcount.c | |
parent | xfs: set firstfsb to NULLFSBLOCK before feeding it to _bmapi_write (diff) | |
download | linux-10479e2dea83d4c421ad05dfc55d918aa8dfc0cd.tar.xz linux-10479e2dea83d4c421ad05dfc55d918aa8dfc0cd.zip |
xfs: check _alloc_read_agf buffer pointer before using
In some circumstances, _alloc_read_agf can return an error code of zero
but also a null AGF buffer pointer. Check for this and jump out.
Fixes-coverity-id: 1415250
Fixes-coverity-id: 1415320
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_refcount.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_refcount.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index 900ea231f9a3..45b1c3b4e047 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -1638,6 +1638,10 @@ xfs_refcount_recover_cow_leftovers( error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); if (error) goto out_trans; + if (!agbp) { + error = -ENOMEM; + goto out_trans; + } cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL); /* Find all the leftover CoW staging extents. */ |