All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ovl: Prevent rw remount when it should be ro mount
@ 2015-01-02 17:26 Seunghun Lee
  2015-01-04  2:59   ` hujianyang
  0 siblings, 1 reply; 15+ messages in thread
From: Seunghun Lee @ 2015-01-02 17:26 UTC (permalink / raw)
  To: miklos
  Cc: sedat.dilek, richard.weinberger, linux-fsdevel, linux-kernel,
	Seunghun Lee

Overlayfs should be mounted read-only when upper-fs is read-only or nonexistent.
But now it can be remounted read-write and this can cause kernel panic.
So we should prevent read-write remount when the above situation happens.

Signed-off-by: Seunghun Lee <waydi1@gmail.com>
---
 fs/overlayfs/super.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..8944651 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -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


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [PATCH] ovl: Prevent rw remount when it should be ro mount
@ 2015-01-01 15:38 Seunghun Lee
  2015-01-01 18:33 ` Sedat Dilek
  0 siblings, 1 reply; 15+ messages in thread
From: Seunghun Lee @ 2015-01-01 15:38 UTC (permalink / raw)
  To: miklos
  Cc: richard.weinberger, sedat.dilek, linux-fsdevel, linux-kernel,
	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.

Signed-off-by: Seunghun Lee <waydi1@gmail.com>
---
 fs/overlayfs/super.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..8944651 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -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


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [PATCH] ovl: Prevent rw remount when it should be ro mount
@ 2015-01-01  5:07 Seunghun Lee
  2015-01-01 15:13 ` Richard Weinberger
  0 siblings, 1 reply; 15+ messages in thread
From: Seunghun Lee @ 2015-01-01  5:07 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, linux-kernel, 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.

Signed-off-by: Seunghun Lee <waydi1@gmail.com>
---
 fs/overlayfs/super.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..1faa5e5 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,6 +522,14 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)
 	return 0;
 }
 
+static int squashfs_remount(struct super_block *sb, int *flags, char *data)
+{
+	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,
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-01-08 13:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-02 17:26 [PATCH] ovl: Prevent rw remount when it should be ro mount Seunghun Lee
2015-01-04  2:59 ` hujianyang
2015-01-04  2:59   ` hujianyang
2015-01-06 14:02   ` Seunghun Lee
2015-01-07  2:56     ` hujianyang
2015-01-07  2:56       ` hujianyang
2015-01-07 15:04       ` Seunghun Lee
2015-01-08 13:50         ` Miklos Szeredi
  -- strict thread matches above, loose matches on Subject: below --
2015-01-01 15:38 Seunghun Lee
2015-01-01 18:33 ` Sedat Dilek
2015-01-02 17:23   ` Seunghun Lee
2015-01-01  5:07 Seunghun Lee
2015-01-01 15:13 ` Richard Weinberger
2015-01-01 15:24   ` Sedat Dilek
2015-01-01 15:30     ` Seunghun Lee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.