Skip to content

Commit

Permalink
isofs: Refuse RW mount of the filesystem instead of making it RO
Browse files Browse the repository at this point in the history
Refuse RW mount of isofs filesystem. So far we just silently changed it
to RO mount but when the media is writeable, block layer won't notice
this change and thus will think device is used RW and will block eject
button of the drive. That is unexpected by users because for
non-writeable media eject button works just fine.

Userspace mount(8) command handles this just fine and retries mounting
with MS_RDONLY set so userspace shouldn't see any regression.  Plus any
tool mounting isofs is likely confronted with the case of read-only
media where block layer already refuses to mount the filesystem without
MS_RDONLY set so our behavior shouldn't be anything new for it.

Reported-by: Hui Wang <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jankara committed Jul 31, 2013
1 parent cf7eff4 commit 17b7f7c
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions fs/isofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ static void destroy_inodecache(void)

static int isofs_remount(struct super_block *sb, int *flags, char *data)
{
/* we probably want a lot more here */
*flags |= MS_RDONLY;
if (!(*flags & MS_RDONLY))
return -EROFS;
return 0;
}

Expand Down Expand Up @@ -763,15 +763,6 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
*/
s->s_maxbytes = 0x80000000000LL;

/*
* The CDROM is read-only, has no nodes (devices) on it, and since
* all of the files appear to be owned by root, we really do not want
* to allow suid. (suid or devices will not show up unless we have
* Rock Ridge extensions)
*/

s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */;

/* Set this for reference. Its not currently used except on write
which we don't have .. */

Expand Down Expand Up @@ -1530,6 +1521,9 @@ struct inode *isofs_iget(struct super_block *sb,
static struct dentry *isofs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
/* We don't support read-write mounts */
if (!(flags & MS_RDONLY))
return ERR_PTR(-EACCES);
return mount_bdev(fs_type, flags, dev_name, data, isofs_fill_super);
}

Expand Down

0 comments on commit 17b7f7c

Please sign in to comment.