mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
xfs: add missing cursor stat checks after xfs_btree_delete
Three xfs_btree_delete() calls in xfs_ialloc.c fail to check the status returns indicating whether a record was actually deleted. If the cursor was pointing to something that couldn't be deleted or didn't exist, something has gone wrong, so mark the fs as sick and return EFSCORRUPTED. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
5beb41df46
commit
b47fb1ed02
|
|
@ -1626,12 +1626,20 @@ xfs_dialloc_ag(
|
|||
*/
|
||||
rec.ir_free &= ~XFS_INOBT_MASK(offset);
|
||||
rec.ir_freecount--;
|
||||
if (rec.ir_freecount)
|
||||
if (rec.ir_freecount) {
|
||||
error = xfs_inobt_update(cur, &rec);
|
||||
else
|
||||
if (error)
|
||||
goto error_cur;
|
||||
} else {
|
||||
error = xfs_btree_delete(cur, &i);
|
||||
if (error)
|
||||
goto error_cur;
|
||||
if (error)
|
||||
goto error_cur;
|
||||
if (XFS_IS_CORRUPT(mp, i != 1)) {
|
||||
xfs_btree_mark_sick(cur);
|
||||
error = -EFSCORRUPTED;
|
||||
goto error_cur;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The finobt has now been updated appropriately. We haven't updated the
|
||||
|
|
@ -2164,6 +2172,11 @@ xfs_difree_inobt(
|
|||
__func__, error);
|
||||
goto error0;
|
||||
}
|
||||
if (XFS_IS_CORRUPT(mp, i != 1)) {
|
||||
xfs_btree_mark_sick(cur);
|
||||
error = -EFSCORRUPTED;
|
||||
goto error0;
|
||||
}
|
||||
|
||||
error = xfs_difree_inode_chunk(tp, pag, &rec);
|
||||
if (error)
|
||||
|
|
@ -2290,7 +2303,11 @@ xfs_difree_finobt(
|
|||
error = xfs_btree_delete(cur, &i);
|
||||
if (error)
|
||||
goto error;
|
||||
ASSERT(i == 1);
|
||||
if (XFS_IS_CORRUPT(mp, i != 1)) {
|
||||
xfs_btree_mark_sick(cur);
|
||||
error = -EFSCORRUPTED;
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
error = xfs_inobt_update(cur, &rec);
|
||||
if (error)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user