]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
This patch makes two changes:
authorWill Drewry <wad@chromium.org>
Wed, 3 Aug 2011 00:52:30 +0000 (10:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 24 Aug 2011 05:24:05 +0000 (15:24 +1000)
- check for trailing characters after parsing PARTNROFF=%d
- disable root_wait if a syntax error is seen

The former assures that bad input like
  root=PARTUUID=<validuuid>/PARTNROFF=5abc
properly fails by attempting to parse an extra character after the
integer.  If the integer is missing, sscanf will fail, but if it is
present, and there is a trailing non-nul character, then the extra
field will be parsed and the error case will be hit.

The latter assures that if rootwait has been specified, the error
message isn't flooded to the screen during rootwait's loop.  Instead of
adding printk ratelimiting, root_wait was disabled.  This stays true to
the rootwait goal of support asynchronous device arrival while still
providing users with helpful messages.  With ratelimiting or disabling
logging on rootwait, a range of edge cases turn up where the user would
not be informed of an error properly.

Signed-off-by: Will Drewry <wad@chromium.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
init/do_mounts.c

index 13cddea01d0eb042a2e5ad93e074a406454481ae..bcbeca7a6655f949ffb70890df43d642d79c8de0 100644 (file)
@@ -110,10 +110,16 @@ static dev_t devt_from_partuuid(char *uuid_str)
 
        /* Check for optional partition number offset attributes. */
        if (uuid_str[36]) {
+               char c = 0;
                /* Explicitly fail on poor PARTUUID syntax. */
-               if (sscanf(&uuid_str[36], "/PARTNROFF=%d", &offset) != 1) {
+               if (sscanf(&uuid_str[36],
+                          "/PARTNROFF=%d%c", &offset, &c) != 1) {
                        printk(KERN_ERR "VFS: PARTUUID= is invalid.\n"
                         "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
+                       if (root_wait)
+                               printk(KERN_ERR
+                                    "Disabling rootwait; root= is invalid.\n");
+                       root_wait = 0;
                        goto done;
                }
        }