Skip to content

Commit

Permalink
fs/partition/msdos: fix unusable extended partition for > 512B sector
Browse files Browse the repository at this point in the history
Smaller size than a minimum blocksize can't be used, after all it's
handled like 0 size.

For extended partition itself, this makes sure to use bigger size than one
logical sector size at least.

Signed-off-by: OGAWA Hirofumi <[email protected]>
Cc: Daniel Taylor <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
OGAWAHirofumi authored and torvalds committed Mar 24, 2010
1 parent 3fbf586 commit 8e0cc81
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions fs/partitions/msdos.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,16 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
if (!size)
continue;
if (is_extended_partition(p)) {
/* prevent someone doing mkfs or mkswap on an
extended partition, but leave room for LILO */
put_partition(state, slot, start, size == 1 ? 1 : 2);
/*
* prevent someone doing mkfs or mkswap on an
* extended partition, but leave room for LILO
* FIXME: this uses one logical sector for > 512b
* sector, although it may not be enough/proper.
*/
sector_t n = 2;
n = min(size, max(sector_size, n));
put_partition(state, slot, start, n);

printk(" <");
parse_extended(state, bdev, start, size);
printk(" >");
Expand Down

0 comments on commit 8e0cc81

Please sign in to comment.