[PATCH] [FS] jffs2: check if partition is marked RO on remount

Sebastian Siewior bigeasy at tglx.de
Thu Mar 6 04:00:50 EST 2008


and if it is, don't tell userspace that write is possible.

Signed-off-by: Sebastian Siewior <bigeasy at linutronix.de>
---
 fs/jffs2/fs.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index e26ea78..a9f474f 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -374,6 +374,9 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
 	if (c->flags & JFFS2_SB_FLAG_RO && !(sb->s_flags & MS_RDONLY))
 		return -EROFS;
 
+	if (!(c->mtd->flags & MTD_WRITEABLE))
+		return -EROFS;
+
 	/* We stop if it was running, then restart if it needs to.
 	   This also catches the case where it was stopped and this
 	   is just a remount to restart it.
-- 
1.5.3.5




More information about the linux-mtd mailing list