diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-12-02 10:57:41 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-12-12 17:45:12 -0800 |
commit | e57e083be9b9bc5c341e1245b988f290c09a5ed7 (patch) | |
tree | e75fd514def7bbdc417b587f5914f01c2ec44e5b /fs/xfs | |
parent | 3853b5e1d7ccb83f572df8a12619d1a58d266d6d (diff) | |
download | linux-stable-e57e083be9b9bc5c341e1245b988f290c09a5ed7.tar.gz linux-stable-e57e083be9b9bc5c341e1245b988f290c09a5ed7.tar.bz2 linux-stable-e57e083be9b9bc5c341e1245b988f290c09a5ed7.zip |
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: <stable@vger.kernel.org> # v6.13-rc1
Fixes: e80fbe1ad8eff7 ("xfs: use metadir for quota inodes")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_qm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 69b70c3e999d..dc8b1010d4d3 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -731,6 +731,13 @@ xfs_qm_create_metadir_qinos( error = xfs_dqinode_mkdir_parent(mp, &qi->qi_dirip); if (error && error != -EEXIST) return error; + /* + * If the /quotas dirent points to an inode that isn't + * loadable, qi_dirip will be NULL but mkdir_parent will return + * -EEXIST. In this case the metadir is corrupt, so bail out. + */ + if (XFS_IS_CORRUPT(mp, qi->qi_dirip == NULL)) + return -EFSCORRUPTED; } if (XFS_IS_UQUOTA_ON(mp) && !qi->qi_uquotaip) { |