From: miklos@szeredi.hu
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch 1/9] unprivileged mounts: fix subtype handling
Date: Thu, 09 Aug 2007 11:20:47 +0200 [thread overview]
Message-ID: <20070809092453.203431503@szeredi.hu> (raw)
In-Reply-To: <20070809092046.656183199@szeredi.hu>
[-- Attachment #1: unprivileged-mounts-fix-subtype.patch --]
[-- Type: text/plain, Size: 2714 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
Subtype handling was done in do_kern_mount(), but "unprivileged
mounts: allow unprivileged mounts" patch made do_new_mount() use
vfs_kern_mount(). This broke the filesystem subtype handling.
Fix this by moving the subtype handling from do_kern_mount() into
do_new_mount(). All other callers are kernel-internal and do not need
subtype support.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c 2007-08-09 11:01:55.000000000 +0200
+++ linux/fs/namespace.c 2007-08-09 11:04:15.000000000 +0200
@@ -1198,6 +1198,29 @@ out:
return err;
}
+static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype)
+{
+ int err;
+ const char *subtype = strchr(fstype, '.');
+ if (subtype) {
+ subtype++;
+ err = -EINVAL;
+ if (!subtype[0])
+ goto err;
+ } else
+ subtype = "";
+
+ mnt->mnt_sb->s_subtype = kstrdup(subtype, GFP_KERNEL);
+ err = -ENOMEM;
+ if (!mnt->mnt_sb->s_subtype)
+ goto err;
+ return mnt;
+
+ err:
+ mntput(mnt);
+ return ERR_PTR(err);
+}
+
/*
* create a new mount for userspace and request it to be added into the
* namespace's tree
@@ -1227,6 +1250,9 @@ static int do_new_mount(struct nameidata
}
mnt = vfs_kern_mount(type, flags & ~MS_SETUSER, name, data);
+ if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
+ !mnt->mnt_sb->s_subtype)
+ mnt = fs_set_subtype(mnt, fstype);
put_filesystem(type);
if (IS_ERR(mnt)) {
if (flags & MS_SETUSER)
Index: linux/fs/super.c
===================================================================
--- linux.orig/fs/super.c 2007-08-09 11:01:55.000000000 +0200
+++ linux/fs/super.c 2007-08-09 11:04:15.000000000 +0200
@@ -906,29 +906,6 @@ out:
EXPORT_SYMBOL_GPL(vfs_kern_mount);
-static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype)
-{
- int err;
- const char *subtype = strchr(fstype, '.');
- if (subtype) {
- subtype++;
- err = -EINVAL;
- if (!subtype[0])
- goto err;
- } else
- subtype = "";
-
- mnt->mnt_sb->s_subtype = kstrdup(subtype, GFP_KERNEL);
- err = -ENOMEM;
- if (!mnt->mnt_sb->s_subtype)
- goto err;
- return mnt;
-
- err:
- mntput(mnt);
- return ERR_PTR(err);
-}
-
struct vfsmount *
do_kern_mount(const char *fstype, int flags, const char *name, void *data)
{
@@ -937,9 +914,6 @@ do_kern_mount(const char *fstype, int fl
if (!type)
return ERR_PTR(-ENODEV);
mnt = vfs_kern_mount(type, flags, name, data);
- if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
- !mnt->mnt_sb->s_subtype)
- mnt = fs_set_subtype(mnt, fstype);
put_filesystem(type);
return mnt;
}
--
next prev parent reply other threads:[~2007-08-09 9:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-09 9:20 [patch 0/9] assorted fixes and cleanups miklos
2007-08-09 9:20 ` miklos [this message]
2007-08-09 9:20 ` [patch 2/9] VFS: check nanoseconds in utimensat miklos
2007-08-09 9:20 ` [patch 3/9] fix execute checking in permission() miklos
2007-08-09 9:20 ` [patch 4/9] exec: remove unnecessary check for MNT_NOEXEC miklos
2007-08-09 9:20 ` [patch 5/9] fuse: fix setting i_mode bits miklos
2007-08-09 9:20 ` [patch 6/9] fuse: clean up execute permission checking miklos
2007-08-09 9:20 ` [patch 7/9] clean out unused code in dentry pruning miklos
2007-08-09 9:20 ` [patch 8/9] UML: remove unnecessary hostfs_getattr() miklos
2007-08-09 9:20 ` [patch 9/9] fix warnings is revoked_inode.c miklos
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=20070809092453.203431503@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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®