Whamcloud - gitweb
e2fsck: make sure quota files are not referenced from dirs
authorJan Kara <jack@suse.cz>
Thu, 12 Aug 2021 13:32:16 +0000 (15:32 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 13 Aug 2021 16:48:58 +0000 (12:48 -0400)
Quota files must not be referenced from directory entries. Otherwise
they can get corrupted under the hands of the kernel.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass2.c

index bd974c5..cb80d33 100644 (file)
@@ -1441,7 +1441,10 @@ skip_checksum:
                name_len = ext2fs_dirent_name_len(dirent);
                if (((dirent->inode != EXT2_ROOT_INO) &&
                     (dirent->inode < EXT2_FIRST_INODE(fs->super))) ||
-                   (dirent->inode > fs->super->s_inodes_count)) {
+                   (dirent->inode > fs->super->s_inodes_count) ||
+                   (dirent->inode == fs->super->s_usr_quota_inum) ||
+                   (dirent->inode == fs->super->s_grp_quota_inum) ||
+                   (dirent->inode == fs->super->s_prj_quota_inum)) {
                        problem = PR_2_BAD_INO;
                } else if (ctx->inode_bb_map &&
                           (ext2fs_test_inode_bitmap2(ctx->inode_bb_map,