(FORWARD) René Scharfe: [PATCH] MSDOS filesystem option mistreatment

(FORWARD) René Scharfe: [PATCH] MSDOS filesystem option mistreatment

Post by Rusty Russel » Thu, 14 Mar 2002 13:40:08



This seems correct.  Al?

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

------- Forwarded Message

Date: Tue, 12 Mar 2002 23:07:58 +0100


Subject: [PATCH] MSDOS filesystem option mistreatment

Hello,

this fixes a longstanding buglet in kernels 2.4 and 2.5, where
the MSDOS filesystem would ignore its 'check' mount option.

Ren

diff -ur linux-2.5.6/fs/msdos/namei.c linux-2.5.6-fat/fs/msdos/namei.c
--- linux-2.5.6/fs/msdos/namei.c        Wed Feb 20 19:49:06 2002

 /***** Formats an MS-DOS file name. Rejects invalid names. */
 static int msdos_format_name(const char *name,int len,
        char *res,struct fat_mount_options *opts)
-       /* conv is relaxed/normal/strict, name is proposed name,
-        * len is the length of the proposed name, res is the result name,
-        * dotsOK is if hidden files get dots.
+       /* name is the proposed name, len is its length, res is
+        * the resulting name, opts->name_check is either (r)elaxed,
+        * (n)ormal or (s)trict, opts->dotsOK allows dots at the
+        * beginning of name (for hidden files)
         */
 {

        for (walk = res; len && walk-res < 8; walk++) {
                c = *name++;
                len--;
-               if (opts->conversion != 'r' && strchr(bad_chars,c))
+               if (opts->name_check != 'r' && strchr(bad_chars,c))
                        return -EINVAL;
-               if (opts->conversion == 's' && strchr(bad_if_strict(opts),c))
+               if (opts->name_check == 's' && strchr(bad_if_strict(opts),c))
                        return -EINVAL;
-               if (c >= 'A' && c <= 'Z' && opts->conversion == 's')
+               if (c >= 'A' && c <= 'Z' && opts->name_check == 's')
                        return -EINVAL;
                if (c < ' ' || c == ':' || c == '\\') return -EINVAL;

                *walk = (!opts->nocase && c >= 'a' && c <= 'z') ? c-32 : c;
        }
        if (space) return -EINVAL;
-       if (opts->conversion == 's' && len && c != '.') {
+       if (opts->name_check == 's' && len && c != '.') {
                c = *name++;
                len--;

                while (len > 0 && walk-res < MSDOS_NAME) {
                        c = *name++;
                        len--;
-                       if (opts->conversion != 'r' && strchr(bad_chars,c))
+                       if (opts->name_check != 'r' && strchr(bad_chars,c))
                                return -EINVAL;
-                       if (opts->conversion == 's' &&
+                       if (opts->name_check == 's' &&
                            strchr(bad_if_strict(opts),c))
                                return -EINVAL;
                        if (c < ' ' || c == ':' || c == '\\')
                                return -EINVAL;
                        if (c == '.') {
-                               if (opts->conversion == 's')
+                               if (opts->name_check == 's')
                                        return -EINVAL;
                                break;
                        }
-                       if (c >= 'A' && c <= 'Z' && opts->conversion == 's')
+                       if (c >= 'A' && c <= 'Z' && opts->name_check == 's')
                                return -EINVAL;
                        space = c == ' ';
                        *walk++ = (!opts->nocase && c >= 'a' && c <= 'z') ? c-32 : c;
                }
                if (space) return -EINVAL;
-               if (opts->conversion == 's' && len) return -EINVAL;
+               if (opts->name_check == 's' && len) return -EINVAL;
        }
        while (walk-res < MSDOS_NAME) *walk++ = ' ';
        if (!opts->atari)

------- End of Forwarded Message

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

(FORWARD) René Scharfe: [PATCH] MSDOS filesystem option mistreatment

Post by Alexander Vir » Thu, 14 Mar 2002 13:40:11



> This seems correct.  Al?

Looks sane...  I don't know who maintains fs/msdos/* these days (and I
seriously suspect that the answer is "nobody"), so probably patch should
go straight to Linus.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

(FORWARD) René Scharfe: [PATCH] MSDOS filesystem option mistreatment

Post by Andreas Dilge » Thu, 14 Mar 2002 14:10:05




> > This seems correct.  Al?

> Looks sane...  I don't know who maintains fs/msdos/* these days (and I
> seriously suspect that the answer is "nobody"), so probably patch should
> go straight to Linus.


a few FAT patches recently.

Cheers, Andreas
--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

(FORWARD) René Scharfe: [PATCH] MSDOS filesystem option mistreatment

Post by OGAWA Hirofum » Thu, 14 Mar 2002 23:50:08





> > > This seems correct.  Al?

> > Looks sane...  I don't know who maintains fs/msdos/* these days (and I
> > seriously suspect that the answer is "nobody"), so probably patch should
> > go straight to Linus.


> a few FAT patches recently.

If I'm maintainer, I'll apply that patch. Thanks.
--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/