Skip to content

Commit e57e083

Browse files
author
Darrick J. Wong
committed
xfs: don't crash on corrupt /quotas dirent
If the /quotas dirent points to an inode but the inode isn't loadable (and hence mkdir returns -EEXIST), don't crash, just bail out. Cc: <[email protected]> # v6.13-rc1 Fixes: e80fbe1 ("xfs: use metadir for quota inodes") Signed-off-by: "Darrick J. Wong" <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 3853b5e commit e57e083

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/xfs/xfs_qm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,13 @@ xfs_qm_create_metadir_qinos(
731731
error = xfs_dqinode_mkdir_parent(mp, &qi->qi_dirip);
732732
if (error && error != -EEXIST)
733733
return error;
734+
/*
735+
* If the /quotas dirent points to an inode that isn't
736+
* loadable, qi_dirip will be NULL but mkdir_parent will return
737+
* -EEXIST. In this case the metadir is corrupt, so bail out.
738+
*/
739+
if (XFS_IS_CORRUPT(mp, qi->qi_dirip == NULL))
740+
return -EFSCORRUPTED;
734741
}
735742

736743
if (XFS_IS_UQUOTA_ON(mp) && !qi->qi_uquotaip) {

0 commit comments

Comments
 (0)