2002-11-30 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/disk_io.c (rawread): Make sure that SECTOR is valid. If not, set ERRNUM to ERR_GEOM and return zero. This check is critical when a partition table is corrupted.
This commit is contained in:
parent
a44e6361bc
commit
f5bc93e4de
3 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2002-11-30 Yoshinori K. Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
|
* stage2/disk_io.c (rawread): Make sure that SECTOR is valid.
|
||||||
|
If not, set ERRNUM to ERR_GEOM and return zero. This check is
|
||||||
|
critical when a partition table is corrupted.
|
||||||
|
|
||||||
2002-11-28 Yoshinori K. Okuji <okuji@enbug.org>
|
2002-11-28 Yoshinori K. Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
* stage2/asm.S (console_cls): Write spaces to the entire screen
|
* stage2/asm.S (console_cls): Write spaces to the entire screen
|
||||||
|
|
|
@ -148,6 +148,13 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
|
||||||
buf_track = -1;
|
buf_track = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure that SECTOR is valid. */
|
||||||
|
if (sector < 0 || sector >= buf_geom.total_sectors)
|
||||||
|
{
|
||||||
|
errnum = ERR_GEOM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get first sector of track */
|
/* Get first sector of track */
|
||||||
soff = sector % buf_geom.sectors;
|
soff = sector % buf_geom.sectors;
|
||||||
track = sector - soff;
|
track = sector - soff;
|
||||||
|
@ -381,8 +388,9 @@ static void
|
||||||
attempt_mount (void)
|
attempt_mount (void)
|
||||||
{
|
{
|
||||||
#ifndef STAGE1_5
|
#ifndef STAGE1_5
|
||||||
for (fsys_type = 0; fsys_type < NUM_FSYS
|
for (fsys_type = 0; fsys_type < NUM_FSYS; fsys_type++)
|
||||||
&& (*(fsys_table[fsys_type].mount_func)) () != 1; fsys_type++);
|
if ((fsys_table[fsys_type].mount_func) ())
|
||||||
|
break;
|
||||||
|
|
||||||
if (fsys_type == NUM_FSYS && errnum == ERR_NONE)
|
if (fsys_type == NUM_FSYS && errnum == ERR_NONE)
|
||||||
errnum = ERR_FSYS_MOUNT;
|
errnum = ERR_FSYS_MOUNT;
|
||||||
|
|
|
@ -587,7 +587,7 @@ reiserfs_mount (void)
|
||||||
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block),
|
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block),
|
||||||
(char *) &super))
|
(char *) &super))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0
|
if (substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0
|
||||||
&& substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0)
|
&& substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0)
|
||||||
{
|
{
|
||||||
|
@ -601,7 +601,7 @@ reiserfs_mount (void)
|
||||||
super.s_version = 0;
|
super.s_version = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check the version number. */
|
/* check the version number. */
|
||||||
if (super.s_version > REISERFS_MAX_SUPPORTED_VERSION)
|
if (super.s_version > REISERFS_MAX_SUPPORTED_VERSION)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -612,7 +612,7 @@ reiserfs_mount (void)
|
||||||
INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS;
|
INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS;
|
||||||
INFO->cached_slots =
|
INFO->cached_slots =
|
||||||
(FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1;
|
(FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1;
|
||||||
|
|
||||||
if (super.s_blocksize < FSYSREISER_MIN_BLOCKSIZE
|
if (super.s_blocksize < FSYSREISER_MIN_BLOCKSIZE
|
||||||
|| super.s_blocksize > FSYSREISER_MAX_BLOCKSIZE
|
|| super.s_blocksize > FSYSREISER_MAX_BLOCKSIZE
|
||||||
|| (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize)
|
|| (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize)
|
||||||
|
@ -643,7 +643,7 @@ reiserfs_mount (void)
|
||||||
printf ("root read_in: block=%d, depth=%d\n",
|
printf ("root read_in: block=%d, depth=%d\n",
|
||||||
super.s_root_block, INFO->tree_depth);
|
super.s_root_block, INFO->tree_depth);
|
||||||
#endif /* REISERDEBUG */
|
#endif /* REISERDEBUG */
|
||||||
|
|
||||||
if (INFO->tree_depth >= MAX_HEIGHT)
|
if (INFO->tree_depth >= MAX_HEIGHT)
|
||||||
return 0;
|
return 0;
|
||||||
if (INFO->tree_depth == DISK_LEAF_NODE_LEVEL)
|
if (INFO->tree_depth == DISK_LEAF_NODE_LEVEL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue