Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10479e2d authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent 4c1a67bd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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. */
+2 −0
Original line number Diff line number Diff line
@@ -170,6 +170,8 @@ xfs_reflink_find_shared(
	error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
	if (error)
		return error;
	if (!agbp)
		return -ENOMEM;

	cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL);