Date: Sun, 26 Feb 2006 17:01:08 +0100 (CET) From: Oliver Fromme <olli@secnetix.de> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Oliver Fromme <olli@secnetix.de> Subject: kern/93860: [patch] [msdosfs] sectors-per-track limit of MSDOSFS too low Message-ID: <200602261601.k1QG18Qi079321@lurza.secnetix.de> Resent-Message-ID: <200602261610.k1QGA53s079278@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 93860 >Category: kern >Synopsis: [patch] [msdosfs] sectors-per-track limit of MSDOSFS too low >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Feb 26 16:10:05 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Oliver Fromme >Release: FreeBSD 6-STABLE >Organization: secnetix GmbH & Co. KG http://www.secnetix.de/bsd >Environment: Problem discovered and patched on RELENG_6. Looking at the CVS repository indicates that it applies to CURRENT and RELENG_5 as well. >Description: I've recently bought a USB flash memory stick with built-in mp3 player. It's an Elta 8061 OL, the flash size is 1 GByte. However, mount_msdosfs refused to mount it (EINVAL). Reformatting it with newfs_msdos is not an option, because the mp3 player only recognizes it when it's formatted with its own firmware. So I had a closer look at the layout of the file system. It's a FAT32 file system with 512 bytes per sector, 8 sectors per cluster, 63 heads and 224 sectors per track. After inspecting the source, I found that the latter (224 sectors per track) is the problem. The source says: if (!pmp->pm_BytesPerSec || !SecPerClust || !pmp->pm_Heads #ifdef PC98 || !pmp->pm_SecPerTrack || pmp->pm_SecPerTrack > 255) { #else || !pmp->pm_SecPerTrack || pmp->pm_SecPerTrack > 63) { #endif error = EINVAL; goto error_exit; } I don't have a PC98 machine, so I hit the limit of 63 sectors per track. It's completely beyond me why there's a different limit for PC98. Why should my USB memory stick work in a PC98 machine, but not in an i386 machine? I simply removed the whole #ifdef and kept only the 255 SecPerTrack limit. Then I could mount the memory stick and copy files without any problems. Please see the patch below. >How-To-Repeat: Try to mount an msdosfs (USB stick, mp3 player) with a FAT32 file system that has more than 63 sectors per track. In case some expert want to have a closer look at the file system in question, this is the first MByte of my USB stick (/dev/da0), gzipped and uuencoded. The first slice (/dev/da0s1) which contains the msdosfs begins at offset 0x4000 (16 KByte). begin 600 elta.dd.gz M'XL("!J!^4,"`V5L=&$N9&0`[=S/:YQ%'`?@>9>X&V)C(U6QN3A7#U6C17J+ M6ZP@V*B-`:4@;,FV;!IWZ[OO"I&`6ZR'1`C](SR%7H0>6E:W*T)O*WKK022H MM)8]6/P12AL:LTVAM>2@GJ(^#PP,[PQS^`X?WKG,K(UUECI+EY:^_BS,MT?G M+XSFSU].?OWD:E@<6VVU"Y\.['LZ&_R@\=%JX]V%[YI?CGS_\T8WUWV\>:.9 M/KCX?&.@>;&Y[Y<TM_C(PI7%+/GXE5PKS*_F/R\TLSVO3[:6I\X6N[O2>/+F MU')C=/6+)'OT\-&9<'0]&\Q/SB0S(PN7SX7]O0<.OW4NR75W+:RE.T]>N)5L M3-ZQ_D/[?+[W</N;?&]'^UJ^5V@5PMF'NB-G3G4:O_5NO5Q]KS1;F8XG2FE6 MR2JU:LQ*1V;+X4":UM(X6RM-5ZK'8NU$.2UE_5Y]KIZ5WPD'*_7ZE@.G_X6: MS20)`^,K5V((867\B?!W32T'````````````````````MH6K(<0[0FYPH_4_ M7@]A)8R'	OE7]5V)S;'TM"?JMEXETO%=]X[MG^<FQ[4\N'#I6*ZO#?EJ;% MTOH=]^]_[\W3^R=?C''O4WOOYO_:1J##"[=G]//?_5/^<_>M_N2WHX/O3[P: M)XH'#]R;_QMCG=NOBMQ<NO13"&]_>'%WJQ#6SISJ9/G^,QZ]WY_YL?M8=_?P MT$2MNF?S$8XX7:D?'QYZ+2W7Z[%4G8O'RW,QJ\6T?*16RX:';*7\\X_SG]MB M_U4'G/^=__^?_W\U````````````````V-ZN;UX+WGEO4Q4````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` H`````````````````````````````````````("_[@]EX@_&```0```` ` end >Fix: This patch is for RELENG_6, but it should apply as well to CURRENT and RELENG_5. --- src/sys/fs/msdosfs/msdosfs_vfsops.c.orig Tue Oct 4 15:13:57 2005 +++ src/sys/fs/msdosfs/msdosfs_vfsops.c Sun Feb 26 16:48:00 2006 @@ -479,11 +479,7 @@ /* XXX - We should probably check more values here */ if (!pmp->pm_BytesPerSec || !SecPerClust || !pmp->pm_Heads -#ifdef PC98 || !pmp->pm_SecPerTrack || pmp->pm_SecPerTrack > 255) { -#else - || !pmp->pm_SecPerTrack || pmp->pm_SecPerTrack > 63) { -#endif error = EINVAL; goto error_exit; } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602261601.k1QG18Qi079321>
