Re: problems with looped extended partitions

Guest section DW (dwguest@win.tue.nl)
Sat, 23 Jan 1999 14:56:21 +0100 (MET)


From: Alex Miller <asm@som.kiev.ua>

In file genhd.c at line 205 is eternal loop, which produce potential
problems when we have record in partition table, pointed at yourself. In this
case kernel hangs while booting.
All this work in stable and development kernels, and seems to be in
long awaited 2.2.0. :(

Yes. Did you encounter this in real life?
Of course a fix would be trivial. Say

--- genhd.c~ Fri Jan 22 16:45:09 1999
+++ genhd.c Sat Jan 23 14:47:12 1999
@@ -189,6 +189,7 @@
*/

#define MSDOS_LABEL_MAGIC 0xAA55
+#define LOOPMAX 1000

static void extended_partition(struct gendisk *hd, kdev_t dev)
{
@@ -196,6 +197,7 @@
struct partition *p;
unsigned long first_sector, first_size, this_sector, this_size;
int mask = (1 << hd->minor_shift) - 1;
+ int loopct = 0;
int i;

first_sector = hd->part[MINOR(dev)].start_sect;
@@ -203,6 +205,8 @@
this_sector = first_sector;

while (1) {
+ if (++loopct >= LOOPMAX)
+ return;
if ((current_minor & mask) == 0)
return;
if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/