git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git]
/
fs
/
super.c
diff --git
a/fs/super.c
b/fs/super.c
index
8d9bff1
..
37b76d7
100644
(file)
--- a/
fs/super.c
+++ b/
fs/super.c
@@
-35,6
+35,8
@@
#include <linux/vfs.h>
#include <linux/writeback.h> /* for the emergency remount stuff */
#include <linux/idr.h>
#include <linux/vfs.h>
#include <linux/writeback.h> /* for the emergency remount stuff */
#include <linux/idr.h>
+#include <linux/devpts_fs.h>
+#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
@@
-569,14
+571,19
@@
static spinlock_t unnamed_dev_lock = SPIN_LOCK_UNLOCKED;/* protects the above */
int set_anon_super(struct super_block *s, void *data)
{
int dev;
int set_anon_super(struct super_block *s, void *data)
{
int dev;
+ int error;
- spin_lock(&unnamed_dev_lock);
- if (idr_pre_get(&unnamed_dev_idr, GFP_ATOMIC) == 0) {
- spin_unlock(&unnamed_dev_lock);
+ retry:
+ if (idr_pre_get(&unnamed_dev_idr, GFP_ATOMIC) == 0)
return -ENOMEM;
return -ENOMEM;
- }
-
dev = idr_get_new(&unnamed_dev_idr, NULL
);
+ spin_lock(&unnamed_dev_lock);
+
error = idr_get_new(&unnamed_dev_idr, NULL, &dev
);
spin_unlock(&unnamed_dev_lock);
spin_unlock(&unnamed_dev_lock);
+ if (error == -EAGAIN)
+ /* We raced and lost with another CPU. */
+ goto retry;
+ else if (error)
+ return -EAGAIN;
if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
spin_lock(&unnamed_dev_lock);
if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
spin_lock(&unnamed_dev_lock);
@@
-781,6
+788,13
@@
do_kern_mount(const char *fstype, int flags, const char *name, void *data)
sb = type->get_sb(type, flags, name, data);
if (IS_ERR(sb))
goto out_free_secdata;
sb = type->get_sb(type, flags, name, data);
if (IS_ERR(sb))
goto out_free_secdata;
+
+ error = -EPERM;
+ if (!capable(CAP_SYS_ADMIN) && !sb->s_bdev &&
+ (sb->s_magic != PROC_SUPER_MAGIC) &&
+ (sb->s_magic != DEVPTS_SUPER_MAGIC))
+ goto out_sb;
+
error = security_sb_kern_mount(sb, secdata);
if (error)
goto out_sb;
error = security_sb_kern_mount(sb, secdata);
if (error)
goto out_sb;
@@
-788,6
+802,7
@@
do_kern_mount(const char *fstype, int flags, const char *name, void *data)
mnt->mnt_root = dget(sb->s_root);
mnt->mnt_mountpoint = sb->s_root;
mnt->mnt_parent = mnt;
mnt->mnt_root = dget(sb->s_root);
mnt->mnt_mountpoint = sb->s_root;
mnt->mnt_parent = mnt;
+ mnt->mnt_namespace = current->namespace;
up_write(&sb->s_umount);
put_filesystem(type);
return mnt;
up_write(&sb->s_umount);
put_filesystem(type);
return mnt;
@@
-804,6
+819,8
@@
out:
return (struct vfsmount *)sb;
}
return (struct vfsmount *)sb;
}
+EXPORT_SYMBOL_GPL(do_kern_mount);
+
struct vfsmount *kern_mount(struct file_system_type *type)
{
return do_kern_mount(type->name, 0, type->name, NULL);
struct vfsmount *kern_mount(struct file_system_type *type)
{
return do_kern_mount(type->name, 0, type->name, NULL);