提交 8e0cc811 编写于 作者: O OGAWA Hirofumi 提交者: Linus Torvalds

fs/partition/msdos: fix unusable extended partition for > 512B sector

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: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Daniel Taylor <Daniel.Taylor@wdc.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <stable@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3fbf586c
......@@ -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(" >");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册