tune2fs: Fix overflow of interval check

Submitted by Kazuya Mio on April 19, 2011, 6:11 a.m.

Details

Message ID 4DAD279B.8070905@sx.jp.nec.com
State Accepted, archived
Headers show

Commit Message

Kazuya Mio April 19, 2011, 6:11 a.m.
Add the check of maximum check interval.
s_checkinterval is 32bit variable, so it cannot be set more than 2^32.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
---
 misc/tune2fs.c |    6 ++++++
 1 file changed, 6 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Theodore Ts'o June 1, 2011, 12:11 a.m.
On Tue, Apr 19, 2011 at 03:11:39PM +0900, Kazuya Mio wrote:
> Add the check of maximum check interval.
> s_checkinterval is 32bit variable, so it cannot be set more than 2^32.
> 
> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>

Applied, thanks.

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

Patch hide | download patch | download mbox

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index bcada11..625866f 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1705,6 +1705,12 @@  retry_open:
 		printf(_("Setting reserved blocks gid to %lu\n"), resgid);
 	}
 	if (i_flag) {
+		if (interval >= (1ULL << 32)) {
+			com_err(program_name, 0,
+				_("interval between checks is too big (%lu)"),
+				interval);
+			exit(1);
+		}
 		sb->s_checkinterval = interval;
 		ext2fs_mark_super_dirty(fs);
 		printf(_("Setting interval between checks to %lu seconds\n"),