lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 13 Jul 2012 15:25:07 -0700
From:	Aditya Kali <adityakali@...gle.com>
To:	tytso@....edu, johann@...mcloud.com, linux-ext4@...r.kernel.org
Cc:	Aditya Kali <adityakali@...gle.com>
Subject: [PATCH 2/4] libquota: fix quota_inode_truncate()

We failed to clear EXT2_FLAG_SUPER_ONLY after deleting the
quota inode and so, the updated block bitmap was not written
back. This caused fsck to complain after running
'tune2fs -O ^quota <dev>'. Clear this flag so that updated
block bitmap gets written. Also, avoid truncating the quota
inode if it is not hidden.

Signed-off-by: Aditya Kali <adityakali@...gle.com>
---
 lib/quota/quotaio.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/quota/quotaio.c b/lib/quota/quotaio.c
index c0ebaa1..7cdd653 100644
--- a/lib/quota/quotaio.c
+++ b/lib/quota/quotaio.c
@@ -133,14 +133,18 @@ errcode_t quota_inode_truncate(ext2_filsys fs, ext2_ino_t ino)
 	if ((err = ext2fs_read_inode(fs, ino, &inode)))
 		return err;
 
-	inode.i_dtime = fs->now ? fs->now : time(0);
-	if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
-		return 0;
-
-	ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_READ_ONLY, NULL,
-			      release_blocks_proc, NULL);
-
-	memset(&inode, 0, sizeof(struct ext2_inode));
+	if ((ino == EXT4_USR_QUOTA_INO) || (ino == EXT4_GRP_QUOTA_INO)) {
+		inode.i_dtime = fs->now ? fs->now : time(0);
+		if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
+			return 0;
+
+		ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_READ_ONLY, NULL,
+				      release_blocks_proc, NULL);
+		fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
+		memset(&inode, 0, sizeof(struct ext2_inode));
+	} else {
+		inode.i_flags &= ~EXT2_IMMUTABLE_FL;
+	}
 	err = ext2fs_write_inode(fs, ino, &inode);
 	return err;
 }
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists