This patch does:
- set MS_RDONLY flag in cramfs superblock
- doesnt allow -w remount in do_remount_sb
if the filesystem has MS_RDONLY set.
Without it, it is possible to remount r/o
filesystem with -w and truncate files on it.
I hope that doesnt fall into 'dont do that then'
category.
Please apply.
Regards,
pkx
diff -ur -x *~ -x *.o -x .* Linux-2.4.3.orig/fs/cramfs/inode.c Linux-2.4.3.isdn.kgdb/fs/cramfs/inode.c
--- Linux-2.4.3.orig/fs/cramfs/inode.c Fri Apr 6 08:09:07 2001
+++ Linux-2.4.3.isdn.kgdb/fs/cramfs/inode.c Mon May 14 18:51:08 2001
@@ -192,6 +192,8 @@
goto out;
}
+ sb->s_flags |= MS_RDONLY;
+
/* Set it all up.. */
sb->s_op = &cramfs_ops;
sb->s_root = d_alloc_root(get_cramfs_inode(sb, &super.root));
diff -ur -x *~ -x *.o -x .* Linux-2.4.3.orig/fs/super.c Linux-2.4.3.isdn.kgdb/fs/super.c
--- Linux-2.4.3.orig/fs/super.c Fri Apr 6 08:09:08 2001
+++ Linux-2.4.3.isdn.kgdb/fs/super.c Tue May 15 10:53:12 2001
@@ -944,7 +944,7 @@
{
int retval;
- if (!(flags & MS_RDONLY) && sb->s_dev && is_read_only(sb->s_dev))
+ if (!(flags & MS_RDONLY) && ((sb->s_flags & MS_RDONLY) || sb->s_dev && is_read_only(sb->s_dev)))
return -EACCES;
/*flags |= MS_RDONLY;*/
/* If we are remounting RDONLY, make sure there are no rw files open */
-- Peter Kundrat peter@kundrat.sk - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/