[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[CRYPTO-LUKS v1 10/19] fs: Fix block lists not being able to address to
From: |
Glenn Washburn |
Subject: |
[CRYPTO-LUKS v1 10/19] fs: Fix block lists not being able to address to end of disk sometimes. |
Date: |
Fri, 31 Jul 2020 07:01:51 -0500 |
When checking if a block list goes past the end of the disk, make sure
the total size of the disk is in grub native sector sizes, otherwise there
will be blocks at the end of the disk unaccessible by block lists.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/kern/fs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
index fb30da9f4..14c17df74 100644
--- a/grub-core/kern/fs.c
+++ b/grub-core/kern/fs.c
@@ -139,6 +139,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
unsigned i;
grub_disk_t disk = file->device->disk;
struct grub_fs_block *blocks;
+ grub_size_t total_native_sectors;
/* First, count the number of blocks. */
do
@@ -156,6 +157,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
return 0;
file->size = 0;
+ total_native_sectors = disk->total_sectors << (disk->log_sector_size -
GRUB_DISK_SECTOR_BITS);
p = (char *) name;
for (i = 0; i < num; i++)
{
@@ -181,7 +183,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
goto fail;
}
- if (disk->total_sectors < blocks[i].offset + blocks[i].length)
+ if (total_native_sectors < blocks[i].offset + blocks[i].length)
{
grub_error (GRUB_ERR_BAD_FILENAME, "beyond the total sectors");
goto fail;
--
2.25.1
- [CRYPTO-LUKS v1 01/19] configure: Add Ubuntu dejavu font path., (continued)
- [CRYPTO-LUKS v1 01/19] configure: Add Ubuntu dejavu font path., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 02/19] cryptodisk: Fix cipher IV mode 'plain64' always being set as 'plain'., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 03/19] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 04/19] cryptodisk: Add more verbosity when reading/writing cryptodisks., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 05/19] luks2: Add support for LUKS2 in (proc)/luks_script, Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 06/19] luks2: Rename source disk variabled named 'disk' to 'source' as in luks.c., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 07/19] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 08/19] cryptodisk, luks: Allow special processing for comparing UUIDs., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 09/19] cryptodisk: Unregister cryptomount command when removing module., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 10/19] fs: Fix block lists not being able to address to end of disk sometimes.,
Glenn Washburn <=
- [CRYPTO-LUKS v1 11/19] cryptodisk: Properly handle non-512 byte sized sectors., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 12/19] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 13/19] fs: Allow number of blocks in block list to be optional, where length will be defaulted to the length of the device., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 14/19] loopback: Add procfs entry 'loopbacks' to output configured loopback devices., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 15/19] cryptodisk, luks2: Add header line to procfs entry and crypto and source device names., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 16/19] cryptodisk: Add a couple comments noting the usage of a couple fields in grub_cryptodisk_t as is done for grub_disk_t., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 17/19] luks2: Ensure that bit fields of grub_luks2_digest_t in luks2_parse_digest are initialized before returning., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 18/19] luks2: Fix use of incorrect index and some error messages., Glenn Washburn, 2020/07/31