Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 079caa3

Browse files
Christoph Hellwigaxboe
authored andcommitted
init: clear root_wait on all invalid root= strings
Instead of only clearing root_wait in devt_from_partuuid when the UUID format was invalid, do that in parse_root_device for all strings that failed to parse. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent cf056a4 commit 079caa3

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

init/do_mounts.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ static int devt_from_partuuid(const char *uuid_str, dev_t *devt)
112112

113113
/* Explicitly fail on poor PARTUUID syntax. */
114114
if (sscanf(slash + 1, "PARTNROFF=%d%c", &offset, &c) != 1)
115-
goto clear_root_wait;
115+
goto out_invalid;
116116
cmp.len = slash - uuid_str;
117117
} else {
118118
cmp.len = strlen(uuid_str);
119119
}
120120

121121
if (!cmp.len)
122-
goto clear_root_wait;
122+
goto out_invalid;
123123

124124
dev = class_find_device(&block_class, NULL, &cmp, &match_dev_by_uuid);
125125
if (!dev)
@@ -139,12 +139,9 @@ static int devt_from_partuuid(const char *uuid_str, dev_t *devt)
139139
put_device(dev);
140140
return 0;
141141

142-
clear_root_wait:
142+
out_invalid:
143143
pr_err("VFS: PARTUUID= is invalid.\n"
144144
"Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
145-
if (root_wait)
146-
pr_err("Disabling rootwait; root= is invalid.\n");
147-
root_wait = 0;
148145
return -EINVAL;
149146
}
150147

@@ -611,6 +608,7 @@ static void __init wait_for_root(char *root_device_name)
611608

612609
static dev_t __init parse_root_device(char *root_device_name)
613610
{
611+
int error;
614612
dev_t dev;
615613

616614
if (!strncmp(root_device_name, "mtd", 3) ||
@@ -623,8 +621,14 @@ static dev_t __init parse_root_device(char *root_device_name)
623621
if (strcmp(root_device_name, "/dev/ram") == 0)
624622
return Root_RAM0;
625623

626-
if (early_lookup_bdev(root_device_name, &dev))
624+
error = early_lookup_bdev(root_device_name, &dev);
625+
if (error) {
626+
if (error == -EINVAL && root_wait) {
627+
pr_err("Disabling rootwait; root= is invalid.\n");
628+
root_wait = 0;
629+
}
627630
return 0;
631+
}
628632
return dev;
629633
}
630634

0 commit comments

Comments
 (0)