ovl: Prevent rw remount when it should be ro mount
Subsystems (2)
PATCH 1/1 ovl: Prevent rw remount when it should be ro mount
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend. But now it can be remounted read-write and this can causes kernel panic. So we should prevent read-write remount when the above situation.
--- fs/overlayfs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/overlayfs/super.c +11 -0
@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)return 0 ; } +static int ovl_remount (struct super_block *sb,int *flags,char *data) +{ +struct ovl_fs *ufs = sb->s_fs_info; + +if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags &MS_RDONLY )) + *flags |=MS_RDONLY ; + +return 0 ; +} +static const struct super_operations ovl_super_operations = { .put_super = ovl_put_super, .statfs = ovl_statfs, .show_options = ovl_show_options, + .remount_fs = ovl_remount, };enum {
Signature · 1 line
2.1.3
Quoted 4 lines · Seunghun Lee
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend. But now it can be remounted read-write and this can causes kernel panic. So we should prevent read-write remount when the above situation.
Cannot say much to the code, but you have some typos in your commit-message. Here some corrections... wording, style etc.
...when upper-fs (with a dash) is read-only (if you write read-write below) or nonexisten*t*...
...this can cause (without s at the end)...
...when the above situation *happens* (missing word)...
- Sedat -
Quoted 34 lines
Signed-off-by Seunghun Lee <[email protected]>--- fs/overlayfs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+)fs/overlayfs/super.c +11
-1@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)return 0 ; } +static int ovl_remount (struct super_block *sb,int *flags,char *data) +{ +struct ovl_fs *ufs = sb->s_fs_info; + +if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags &MS_RDONLY )) + *flags |=MS_RDONLY ; + +return 0 ; +} +static const struct super_operations ovl_super_operations = { .put_super = ovl_put_super, .statfs = ovl_statfs, .show_options = ovl_show_options, + .remount_fs = ovl_remount, };enum { --2.1.3
Quoted 45 lines · Sedat Dilek
Quoted 4 lines · Seunghun Lee
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend. But now it can be remounted read-write and this can causes kernel panic. So we should prevent read-write remount when the above situation.
Cannot say much to the code, but you have some typos in your commit-message. Here some corrections... wording, style etc.
...when upper-fs (with a dash) is read-only (if you write read-write below) or nonexisten*t*...
...this can cause (without s at the end)...
...when the above situation *happens* (missing word)...- Sedat -
Quoted 30 lines
Signed-off-by Seunghun Lee <[email protected]>--- fs/overlayfs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+)fs/overlayfs/super.c +11
-0@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)return 0 ; } +static int ovl_remount (struct super_block *sb,int *flags,char *data) +{ +struct ovl_fs *ufs = sb->s_fs_info; + +if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags &MS_RDONLY )) + *flags |=MS_RDONLY ; + +return 0 ; +} +static const struct super_operations ovl_super_operations = { .put_super = ovl_put_super, .statfs = ovl_statfs, .show_options = ovl_show_options, + .remount_fs = ovl_remount, };
Quoted 4 lines
Quoted 4 lines
fs/overlayfs/super.c +0
-1enum { --2.1.3
Thank you for your correction!
I will fix it.
Thanks.