+ fat-detect-media-without-partition-table-correctly.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     fat: detect media without partition table correctly
has been added to the -mm tree.  Its filename is
     fat-detect-media-without-partition-table-correctly.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: fat: detect media without partition table correctly
From: Frank Seidel <fseidel@xxxxxxx>

I received a complaint that some FAT formated medias
(e.g. sd memory cards) trigger a "unknown partition table" message even though
there is no partition table and they work correctly, while in general
(when e.g. formated with mkdosfs or even Windows Vista) this message is not
shown.

Currently this seems only to happen when the medias get formatted with
Windows XP (and possibly Win 2000). Then the boot indicator byte contains
garbage (part of text message) and so do the other parts checked by
msdos_paritition which then later triggers this message.

References: novell bug #364365

Most fat formatted media without partition table contains zeros in the boot
indication and the other tested bytes and so falls through the checks in
msdos_partition, leading it to return with 1 (all is fine).

But some (e.g.  WinXP formatted) fat fomated medias don't use boot_ind and so
the check fails and causes a "unkown partition table" warning eventhough there
is none and everything would be fine.

This additional check directly verifies if there is a fat formatted medium
without a partition table.

Signed-off-by: Frank Seidel <fseidel@xxxxxxx>
Cc: Andreas Dilger <adilger@xxxxxxx>
Cc: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/partitions/msdos.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff -puN fs/partitions/msdos.c~fat-detect-media-without-partition-table-correctly fs/partitions/msdos.c
--- a/fs/partitions/msdos.c~fat-detect-media-without-partition-table-correctly
+++ a/fs/partitions/msdos.c
@@ -18,7 +18,7 @@
  *
  *  Re-organised Feb 1998 Russell King
  */
-
+#include <linux/msdos_fs.h>
 
 #include "check.h"
 #include "msdos.h"
@@ -419,6 +419,7 @@ int msdos_partition(struct parsed_partit
 	Sector sect;
 	unsigned char *data;
 	struct partition *p;
+	struct fat_boot_sector *fb;
 	int slot;
 
 	data = read_dev_sector(bdev, 0, &sect);
@@ -441,6 +442,12 @@ int msdos_partition(struct parsed_partit
 	 * partition table. Reject this in case the boot indicator
 	 * is not 0 or 0x80.
 	 */
+	fb = (struct fat_boot_sector *) data;
+	if (fb->reserved && fb->fats && FAT_VALID_MEDIA(fb->media)) {
+		printk("\n");
+		put_dev_sector(sect);
+		return 1;
+	}
 	p = (struct partition *) (data + 0x1be);
 	for (slot = 1; slot <= 4; slot++, p++) {
 		if (p->boot_ind != 0 && p->boot_ind != 0x80) {
_

Patches currently in -mm which might be from fseidel@xxxxxxx are

fat-detect-media-without-partition-table-correctly.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux