Merge v3.9-rc5 into driver-core-next
We want the fixes in here. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -1007,6 +1007,8 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
|
||||
ino = parent_sd->s_ino;
|
||||
if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) == 0)
|
||||
filp->f_pos++;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (filp->f_pos == 1) {
|
||||
if (parent_sd->s_parent)
|
||||
@@ -1015,6 +1017,8 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
|
||||
ino = parent_sd->s_ino;
|
||||
if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) == 0)
|
||||
filp->f_pos++;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
mutex_lock(&sysfs_mutex);
|
||||
for (pos = sysfs_dir_pos(ns, parent_sd, filp->f_pos, pos);
|
||||
@@ -1045,10 +1049,21 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
|
||||
{
|
||||
struct inode *inode = file_inode(file);
|
||||
loff_t ret;
|
||||
|
||||
mutex_lock(&inode->i_mutex);
|
||||
ret = generic_file_llseek(file, offset, whence);
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct file_operations sysfs_dir_operations = {
|
||||
.read = generic_read_dir,
|
||||
.readdir = sysfs_readdir,
|
||||
.release = sysfs_dir_release,
|
||||
.llseek = generic_file_llseek,
|
||||
.llseek = sysfs_dir_llseek,
|
||||
};
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/user_namespace.h>
|
||||
|
||||
#include "sysfs.h"
|
||||
|
||||
@@ -111,6 +112,9 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
|
||||
struct super_block *sb;
|
||||
int error;
|
||||
|
||||
if (!(flags & MS_KERNMOUNT) && !current_user_ns()->may_mount_sysfs)
|
||||
return ERR_PTR(-EPERM);
|
||||
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
Reference in New Issue
Block a user