From: Will Drewry Date: Wed, 3 Aug 2011 00:52:30 +0000 (+1000) Subject: This patch makes two changes: X-Git-Tag: next-20110824~2^2~83 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bd55329bbafc699a271e069eef997d9c04e36c1f;p=karo-tx-linux.git This patch makes two changes: - 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=/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 Cc: Kay Sievers Cc: Randy Dunlap Cc: Namhyung Kim Cc: Trond Myklebust Cc: Jens Axboe Signed-off-by: Andrew Morton --- diff --git a/init/do_mounts.c b/init/do_mounts.c index 13cddea01d0e..bcbeca7a6655 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -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=[/PARTNROFF=%%d]\n"); + if (root_wait) + printk(KERN_ERR + "Disabling rootwait; root= is invalid.\n"); + root_wait = 0; goto done; } }