mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Kundrat <kundrat@kundrat.sk>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: MS_RDONLY patch (do_remount_sb and cramfs/inode.c)
Date: Tue, 15 May 2001 11:27:26 +0200	[thread overview]
Message-ID: <20010515112726.A28961@napri.sk> (raw)

Hello,

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

             reply	other threads:[~2001-05-15  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-15  9:27 Peter Kundrat [this message]
2001-05-15 10:24 ` Peter Kundrat
2001-05-15 11:16   ` Peter Kundrat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010515112726.A28961@napri.sk \
    --to=kundrat@kundrat.sk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®