[PATCH] mount: detect an attempt to mount iso9660 read-write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

following patch fixes Novell bug #481123:
https://bugzilla.novell.com/show_bug.cgi?id=481123


Linux kernel silently adds MS_RDONLY flag when mounting iso9660
file system, which leads to having 'rw' in mtab and 'ro' in
/proc/mounts.

Reported-by: James Foris <jim.foris@xxxxxxxxxx>
Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
 mount/mount.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/mount/mount.c b/mount/mount.c
index 576fed6..2ffb146 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1435,6 +1435,16 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
       flags &= ~MS_RDONLY;
   }
 
+  /* Kernel silently adds MS_RDONLY flag when mounting iso9660 file system.
+   * Check this to avoid 'ro' in /proc/mounts and 'rw' in mtab.
+   */
+  if (!fake && mnt5_res == 0 &&
+      !(flags & MS_RDONLY) && !strcmp(types, "iso9660")) {
+
+      printf(_("mount: warning: %s seems to be mounted read-only.\n"), node);
+      flags |= MS_RDONLY;
+  }
+
   if (fake || mnt5_res == 0) {
       /* Mount succeeded, report this (if verbose) and write mtab entry.  */
 
-- 
1.6.4.2


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

Attachment: pgpFSTTRYmpb1.pgp
Description: PGP signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux