]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.33.2/fs-partition-msdos-fix-unusable-extended-partition-for-512b-sector.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.33.2 / fs-partition-msdos-fix-unusable-extended-partition-for-512b-sector.patch
1 From 8e0cc811e0f8029a7225372fb0951fab102c012f Mon Sep 17 00:00:00 2001
2 From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
3 Date: Tue, 23 Mar 2010 13:35:50 -0700
4 Subject: fs/partition/msdos: fix unusable extended partition for > 512B sector
5
6 From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
7
8 commit 8e0cc811e0f8029a7225372fb0951fab102c012f upstream.
9
10 Smaller size than a minimum blocksize can't be used, after all it's
11 handled like 0 size.
12
13 For extended partition itself, this makes sure to use bigger size than one
14 logical sector size at least.
15
16 Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
17 Cc: Daniel Taylor <Daniel.Taylor@wdc.com>
18 Cc: "H. Peter Anvin" <hpa@zytor.com>
19 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22
23 ---
24 fs/partitions/msdos.c | 13 ++++++++++---
25 1 file changed, 10 insertions(+), 3 deletions(-)
26
27 --- a/fs/partitions/msdos.c
28 +++ b/fs/partitions/msdos.c
29 @@ -492,9 +492,16 @@ int msdos_partition(struct parsed_partit
30 if (!size)
31 continue;
32 if (is_extended_partition(p)) {
33 - /* prevent someone doing mkfs or mkswap on an
34 - extended partition, but leave room for LILO */
35 - put_partition(state, slot, start, size == 1 ? 1 : 2);
36 + /*
37 + * prevent someone doing mkfs or mkswap on an
38 + * extended partition, but leave room for LILO
39 + * FIXME: this uses one logical sector for > 512b
40 + * sector, although it may not be enough/proper.
41 + */
42 + sector_t n = 2;
43 + n = min(size, max(sector_size, n));
44 + put_partition(state, slot, start, n);
45 +
46 printk(" <");
47 parse_extended(state, bdev, start, size);
48 printk(" >");