grub2/0144-Reject-NILFS2-superblocks-with-over-1GiB-blocks.patch

48 lines
1.4 KiB
Diff
Raw Normal View History

From 9201cd79a33a5f802cdf78437eca91082f382d55 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 14:27:27 +0100
Subject: [PATCH 144/506] Reject NILFS2 superblocks with over 1GiB blocks.
* grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that
block size is <= 1GiB.
---
ChangeLog | 7 +++++++
grub-core/fs/nilfs2.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 575bd18..454aef8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+ Reject NILFS2 superblocks with over 1GiB blocks.
+
+ * grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that
+ block size is <= 1GiB.
+
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/disk/ata.c (grub_ata_setaddress): Check that geometry
is sane when using CHS addressing.
diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c
index 388ee18..598a2a5 100644
--- a/grub-core/fs/nilfs2.c
+++ b/grub-core/fs/nilfs2.c
@@ -724,6 +724,10 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp)
if (grub_le_to_cpu32 (sbp->s_rev_level) != NILFS_SUPORT_REV)
return 0;
+ /* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */
+ if (grub_le_to_cpu32 (sbp->s_log_block_size) > 20)
+ return 0;
+
return 1;
}
--
2.4.3