Skip to content

Commit

Permalink
init: fix read-write root mount
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Dec 17, 2014
1 parent 7d65cf1 commit 1097593
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions init/do_mounts.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,6 @@ void __init mount_block_root(char *name, int flags)
case 0:
goto out;
case -EACCES:
flags |= MS_RDONLY;
goto retry;
case -EINVAL:
continue;
}
Expand All @@ -419,6 +417,10 @@ void __init mount_block_root(char *name, int flags)
#endif
panic("VFS: Unable to mount root fs on %s", b);
}
if (!(flags & MS_RDONLY)) {
flags |= MS_RDONLY;
goto retry;
}

printk("List of all partitions:\n");
printk_all_partitions();
Expand Down

0 comments on commit 1097593

Please sign in to comment.