diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-11-20 10:08:59 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-17 08:27:14 -0500 |
commit | 10975933da3d65f8833d4ce98dcc2ecc63a695d6 (patch) | |
tree | d68accb6a448af5031c2e4fb524e2557cdfb50d2 /init | |
parent | 7d65cf10e3d7747033b83fa18c5f3d2a498f66bc (diff) |
init: fix read-write root mount
If mount flags don't have MS_RDONLY, iso9660 returns EACCES without actually
checking if it's an iso image.
This tricks mount_block_root() into retrying with MS_RDONLY. This results
in a read-only root despite the "rw" boot parameter if the actual
filesystem was checked after iso9660.
I believe the behavior of iso9660 is okay, while that of mount_block_root()
is not. It should rather try all types without MS_RDONLY and only then
retry with MS_RDONLY.
This change also makes the code more robust against the case when EACCES is
returned despite MS_RDONLY, which would've resulted in a lockup.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'init')
-rw-r--r-- | init/do_mounts.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c index 9b3565c41502..eb410083e8e0 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -395,8 +395,6 @@ retry: | |||
395 | case 0: | 395 | case 0: |
396 | goto out; | 396 | goto out; |
397 | case -EACCES: | 397 | case -EACCES: |
398 | flags |= MS_RDONLY; | ||
399 | goto retry; | ||
400 | case -EINVAL: | 398 | case -EINVAL: |
401 | continue; | 399 | continue; |
402 | } | 400 | } |
@@ -419,6 +417,10 @@ retry: | |||
419 | #endif | 417 | #endif |
420 | panic("VFS: Unable to mount root fs on %s", b); | 418 | panic("VFS: Unable to mount root fs on %s", b); |
421 | } | 419 | } |
420 | if (!(flags & MS_RDONLY)) { | ||
421 | flags |= MS_RDONLY; | ||
422 | goto retry; | ||
423 | } | ||
422 | 424 | ||
423 | printk("List of all partitions:\n"); | 425 | printk("List of all partitions:\n"); |
424 | printk_all_partitions(); | 426 | printk_all_partitions(); |