Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / partitions / msdos.c
index 3ed5cb5..9935d25 100644 (file)
@@ -202,12 +202,12 @@ parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev,
 #endif
 }
 
-#if defined(CONFIG_BSD_DISKLABEL) || defined(CONFIG_NEC98_PARTITION)
+#if defined(CONFIG_BSD_DISKLABEL)
 /* 
  * Create devices for BSD partitions listed in a disklabel, under a
  * dos-like partition. See parse_extended() for more information.
  */
-void
+static void
 parse_bsd(struct parsed_partitions *state, struct block_device *bdev,
                u32 offset, u32 size, int origin, char *flavour,
                int max_partitions)
@@ -246,6 +246,9 @@ parse_bsd(struct parsed_partitions *state, struct block_device *bdev,
                put_partition(state, state->next++, bsd_start, bsd_size);
        }
        put_dev_sector(sect);
+       if (le16_to_cpu(l->d_npartitions) > max_partitions)
+               printk(" (ignored %d more)",
+                      le16_to_cpu(l->d_npartitions) - max_partitions);
        printk(" >\n");
 }
 #endif
@@ -371,6 +374,7 @@ static struct {
        {MINIX_PARTITION, parse_minix},
        {UNIXWARE_PARTITION, parse_unixware},
        {SOLARIS_X86_PARTITION, parse_solaris_x86},
+       {NEW_SOLARIS_X86_PARTITION, parse_solaris_x86},
        {0, NULL},
 };
  
@@ -389,8 +393,23 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
                put_dev_sector(sect);
                return 0;
        }
+
+       /*
+        * Now that the 55aa signature is present, this is probably
+        * either the boot sector of a FAT filesystem or a DOS-type
+        * partition table. Reject this in case the boot indicator
+        * is not 0 or 0x80.
+        */
        p = (struct partition *) (data + 0x1be);
+       for (slot = 1; slot <= 4; slot++, p++) {
+               if (p->boot_ind != 0 && p->boot_ind != 0x80) {
+                       put_dev_sector(sect);
+                       return 0;
+               }
+       }
+
 #ifdef CONFIG_EFI_PARTITION
+       p = (struct partition *) (data + 0x1be);
        for (slot = 1 ; slot <= 4 ; slot++, p++) {
                /* If this is an EFI GPT disk, msdos should ignore it. */
                if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) {
@@ -398,8 +417,8 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
                        return 0;
                }
        }
-       p = (struct partition *) (data + 0x1be);
 #endif
+       p = (struct partition *) (data + 0x1be);
 
        /*
         * Look for partitions in two passes: