Commit 98c89cdd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'bkl/procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing

* 'bkl/procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  sunrpc: Include missing smp_lock.h
  procfs: Kill the bkl in ioctl
  procfs: Push down the bkl from ioctl
  procfs: Use generic_file_llseek in /proc/vmcore
  procfs: Use generic_file_llseek in /proc/kmsg
  procfs: Use generic_file_llseek in /proc/kcore
  procfs: Kill BKL in llseek on proc base
parents 164d44fd 99df95a2
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -82,8 +83,7 @@ module_param(fan_mult, int, 0); ...@@ -82,8 +83,7 @@ module_param(fan_mult, int, 0);
MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with"); MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with");
static int i8k_open_fs(struct inode *inode, struct file *file); static int i8k_open_fs(struct inode *inode, struct file *file);
static int i8k_ioctl(struct inode *, struct file *, unsigned int, static long i8k_ioctl(struct file *, unsigned int, unsigned long);
unsigned long);
static const struct file_operations i8k_fops = { static const struct file_operations i8k_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -91,7 +91,7 @@ static const struct file_operations i8k_fops = { ...@@ -91,7 +91,7 @@ static const struct file_operations i8k_fops = {
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
.ioctl = i8k_ioctl, .unlocked_ioctl = i8k_ioctl,
}; };
struct smm_regs { struct smm_regs {
...@@ -307,8 +307,8 @@ static int i8k_get_dell_signature(int req_fn) ...@@ -307,8 +307,8 @@ static int i8k_get_dell_signature(int req_fn)
return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1; return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1;
} }
static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, static int
unsigned long arg) i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg)
{ {
int val = 0; int val = 0;
int speed; int speed;
...@@ -395,6 +395,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, ...@@ -395,6 +395,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
return 0; return 0;
} }
static long i8k_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = i8k_ioctl_unlocked(fp, cmd, arg);
unlock_kernel();
return ret;
}
/* /*
* Print the information for /proc/i8k. * Print the information for /proc/i8k.
*/ */
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/isdnif.h> #include <linux/isdnif.h>
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <linux/smp_lock.h>
#include "isdn_divert.h" #include "isdn_divert.h"
...@@ -177,9 +178,7 @@ isdn_divert_close(struct inode *ino, struct file *filep) ...@@ -177,9 +178,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
/*********/ /*********/
/* IOCTL */ /* IOCTL */
/*********/ /*********/
static int static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg)
isdn_divert_ioctl(struct inode *inode, struct file *file,
uint cmd, ulong arg)
{ {
divert_ioctl dioctl; divert_ioctl dioctl;
int i; int i;
...@@ -258,6 +257,17 @@ isdn_divert_ioctl(struct inode *inode, struct file *file, ...@@ -258,6 +257,17 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0; return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
} /* isdn_divert_ioctl */ } /* isdn_divert_ioctl */
static long isdn_divert_ioctl(struct file *file, uint cmd, ulong arg)
{
long ret;
lock_kernel();
ret = isdn_divert_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
static const struct file_operations isdn_fops = static const struct file_operations isdn_fops =
{ {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -265,7 +275,7 @@ static const struct file_operations isdn_fops = ...@@ -265,7 +275,7 @@ static const struct file_operations isdn_fops =
.read = isdn_divert_read, .read = isdn_divert_read,
.write = isdn_divert_write, .write = isdn_divert_write,
.poll = isdn_divert_poll, .poll = isdn_divert_poll,
.ioctl = isdn_divert_ioctl, .unlocked_ioctl = isdn_divert_ioctl,
.open = isdn_divert_open, .open = isdn_divert_open,
.release = isdn_divert_close, .release = isdn_divert_close,
}; };
......
...@@ -730,6 +730,7 @@ static ssize_t proc_info_read(struct file * file, char __user * buf, ...@@ -730,6 +730,7 @@ static ssize_t proc_info_read(struct file * file, char __user * buf,
static const struct file_operations proc_info_file_operations = { static const struct file_operations proc_info_file_operations = {
.read = proc_info_read, .read = proc_info_read,
.llseek = generic_file_llseek,
}; };
static int proc_single_show(struct seq_file *m, void *v) static int proc_single_show(struct seq_file *m, void *v)
...@@ -987,6 +988,7 @@ static ssize_t environ_read(struct file *file, char __user *buf, ...@@ -987,6 +988,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
static const struct file_operations proc_environ_operations = { static const struct file_operations proc_environ_operations = {
.read = environ_read, .read = environ_read,
.llseek = generic_file_llseek,
}; };
static ssize_t oom_adjust_read(struct file *file, char __user *buf, static ssize_t oom_adjust_read(struct file *file, char __user *buf,
...@@ -1060,6 +1062,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, ...@@ -1060,6 +1062,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
static const struct file_operations proc_oom_adjust_operations = { static const struct file_operations proc_oom_adjust_operations = {
.read = oom_adjust_read, .read = oom_adjust_read,
.write = oom_adjust_write, .write = oom_adjust_write,
.llseek = generic_file_llseek,
}; };
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
...@@ -1131,6 +1134,7 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, ...@@ -1131,6 +1134,7 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
static const struct file_operations proc_loginuid_operations = { static const struct file_operations proc_loginuid_operations = {
.read = proc_loginuid_read, .read = proc_loginuid_read,
.write = proc_loginuid_write, .write = proc_loginuid_write,
.llseek = generic_file_llseek,
}; };
static ssize_t proc_sessionid_read(struct file * file, char __user * buf, static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
...@@ -1151,6 +1155,7 @@ static ssize_t proc_sessionid_read(struct file * file, char __user * buf, ...@@ -1151,6 +1155,7 @@ static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
static const struct file_operations proc_sessionid_operations = { static const struct file_operations proc_sessionid_operations = {
.read = proc_sessionid_read, .read = proc_sessionid_read,
.llseek = generic_file_llseek,
}; };
#endif #endif
...@@ -1202,6 +1207,7 @@ static ssize_t proc_fault_inject_write(struct file * file, ...@@ -1202,6 +1207,7 @@ static ssize_t proc_fault_inject_write(struct file * file,
static const struct file_operations proc_fault_inject_operations = { static const struct file_operations proc_fault_inject_operations = {
.read = proc_fault_inject_read, .read = proc_fault_inject_read,
.write = proc_fault_inject_write, .write = proc_fault_inject_write,
.llseek = generic_file_llseek,
}; };
#endif #endif
...@@ -1943,7 +1949,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf, ...@@ -1943,7 +1949,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
} }
static const struct file_operations proc_fdinfo_file_operations = { static const struct file_operations proc_fdinfo_file_operations = {
.open = nonseekable_open, .open = nonseekable_open,
.read = proc_fdinfo_read, .read = proc_fdinfo_read,
}; };
...@@ -2227,6 +2233,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, ...@@ -2227,6 +2233,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
static const struct file_operations proc_pid_attr_operations = { static const struct file_operations proc_pid_attr_operations = {
.read = proc_pid_attr_read, .read = proc_pid_attr_read,
.write = proc_pid_attr_write, .write = proc_pid_attr_write,
.llseek = generic_file_llseek,
}; };
static const struct pid_entry attr_dir_stuff[] = { static const struct pid_entry attr_dir_stuff[] = {
...@@ -2347,6 +2354,7 @@ static ssize_t proc_coredump_filter_write(struct file *file, ...@@ -2347,6 +2354,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
static const struct file_operations proc_coredump_filter_operations = { static const struct file_operations proc_coredump_filter_operations = {
.read = proc_coredump_filter_read, .read = proc_coredump_filter_read,
.write = proc_coredump_filter_write, .write = proc_coredump_filter_write,
.llseek = generic_file_llseek,
}; };
#endif #endif
......
...@@ -232,9 +232,9 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne ...@@ -232,9 +232,9 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
if (rv == -ENOIOCTLCMD) if (rv == -ENOIOCTLCMD)
rv = -EINVAL; rv = -EINVAL;
} else if (ioctl) { } else if (ioctl) {
lock_kernel(); WARN_ONCE(1, "Procfs ioctl handlers must use unlocked_ioctl, "
"%pf will be called without the Bkl held\n", ioctl);
rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg); rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
unlock_kernel();
} }
pde_users_dec(pde); pde_users_dec(pde);
......
...@@ -558,6 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp) ...@@ -558,6 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp)
static const struct file_operations proc_kcore_operations = { static const struct file_operations proc_kcore_operations = {
.read = read_kcore, .read = read_kcore,
.open = open_kcore, .open = open_kcore,
.llseek = generic_file_llseek,
}; };
#ifdef CONFIG_MEMORY_HOTPLUG #ifdef CONFIG_MEMORY_HOTPLUG
......
...@@ -53,6 +53,7 @@ static const struct file_operations proc_kmsg_operations = { ...@@ -53,6 +53,7 @@ static const struct file_operations proc_kmsg_operations = {
.poll = kmsg_poll, .poll = kmsg_poll,
.open = kmsg_open, .open = kmsg_open,
.release = kmsg_release, .release = kmsg_release,
.llseek = generic_file_llseek,
}; };
static int __init proc_kmsg_init(void) static int __init proc_kmsg_init(void)
......
...@@ -163,6 +163,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer, ...@@ -163,6 +163,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
static const struct file_operations proc_vmcore_operations = { static const struct file_operations proc_vmcore_operations = {
.read = read_vmcore, .read = read_vmcore,
.llseek = generic_file_llseek,
}; };
static struct vmcore* __init get_new_element(void) static struct vmcore* __init get_new_element(void)
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/smp_lock.h>
#include <asm/ioctls.h> #include <asm/ioctls.h>
#include <linux/sunrpc/types.h> #include <linux/sunrpc/types.h>
#include <linux/sunrpc/cache.h> #include <linux/sunrpc/cache.h>
...@@ -1331,12 +1332,18 @@ static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) ...@@ -1331,12 +1332,18 @@ static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait)
return cache_poll(filp, wait, cd); return cache_poll(filp, wait, cd);
} }
static int cache_ioctl_procfs(struct inode *inode, struct file *filp, static long cache_ioctl_procfs(struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
long ret;
struct inode *inode = filp->f_path.dentry->d_inode;
struct cache_detail *cd = PDE(inode)->data; struct cache_detail *cd = PDE(inode)->data;
return cache_ioctl(inode, filp, cmd, arg, cd); lock_kernel();
ret = cache_ioctl(inode, filp, cmd, arg, cd);
unlock_kernel();
return ret;
} }
static int cache_open_procfs(struct inode *inode, struct file *filp) static int cache_open_procfs(struct inode *inode, struct file *filp)
...@@ -1359,7 +1366,7 @@ static const struct file_operations cache_file_operations_procfs = { ...@@ -1359,7 +1366,7 @@ static const struct file_operations cache_file_operations_procfs = {
.read = cache_read_procfs, .read = cache_read_procfs,
.write = cache_write_procfs, .write = cache_write_procfs,
.poll = cache_poll_procfs, .poll = cache_poll_procfs,
.ioctl = cache_ioctl_procfs, /* for FIONREAD */ .unlocked_ioctl = cache_ioctl_procfs, /* for FIONREAD */
.open = cache_open_procfs, .open = cache_open_procfs,
.release = cache_release_procfs, .release = cache_release_procfs,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment