Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98c89cdd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* '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
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/seq_file.h>
#include <linux/dmi.h>
#include <linux/capability.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/io.h>

@@ -82,8 +83,7 @@ module_param(fan_mult, int, 0);
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_ioctl(struct inode *, struct file *, unsigned int,
		     unsigned long);
static long i8k_ioctl(struct file *, unsigned int, unsigned long);

static const struct file_operations i8k_fops = {
	.owner		= THIS_MODULE,
@@ -91,7 +91,7 @@ static const struct file_operations i8k_fops = {
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
	.ioctl		= i8k_ioctl,
	.unlocked_ioctl	= i8k_ioctl,
};

struct smm_regs {
@@ -307,8 +307,8 @@ static int i8k_get_dell_signature(int req_fn)
	return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1;
}

static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
		     unsigned long arg)
static int
i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg)
{
	int val = 0;
	int speed;
@@ -395,6 +395,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
	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.
 */
+14 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/sched.h>
#include <linux/isdnif.h>
#include <net/net_namespace.h>
#include <linux/smp_lock.h>
#include "isdn_divert.h"


@@ -177,9 +178,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
/*********/
/* IOCTL */
/*********/
static int
isdn_divert_ioctl(struct inode *inode, struct file *file,
		  uint cmd, ulong arg)
static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg)
{
	divert_ioctl dioctl;
	int i;
@@ -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;
}				/* 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 =
{
	.owner          = THIS_MODULE,
@@ -265,7 +275,7 @@ static const struct file_operations isdn_fops =
	.read           = isdn_divert_read,
	.write          = isdn_divert_write,
	.poll           = isdn_divert_poll,
	.ioctl          = isdn_divert_ioctl,
	.unlocked_ioctl = isdn_divert_ioctl,
	.open           = isdn_divert_open,
	.release        = isdn_divert_close,                                      
};
+9 −1
Original line number Diff line number Diff line
@@ -730,6 +730,7 @@ out_no_task:

static const struct file_operations proc_info_file_operations = {
	.read		= proc_info_read,
	.llseek		= generic_file_llseek,
};

static int proc_single_show(struct seq_file *m, void *v)
@@ -987,6 +988,7 @@ out_no_task:

static const struct file_operations proc_environ_operations = {
	.read		= environ_read,
	.llseek		= generic_file_llseek,
};

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,
static const struct file_operations proc_oom_adjust_operations = {
	.read		= oom_adjust_read,
	.write		= oom_adjust_write,
	.llseek		= generic_file_llseek,
};

#ifdef CONFIG_AUDITSYSCALL
@@ -1131,6 +1134,7 @@ out_free_page:
static const struct file_operations proc_loginuid_operations = {
	.read		= proc_loginuid_read,
	.write		= proc_loginuid_write,
	.llseek		= generic_file_llseek,
};

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 = {
	.read		= proc_sessionid_read,
	.llseek		= generic_file_llseek,
};
#endif

@@ -1202,6 +1207,7 @@ static ssize_t proc_fault_inject_write(struct file * file,
static const struct file_operations proc_fault_inject_operations = {
	.read		= proc_fault_inject_read,
	.write		= proc_fault_inject_write,
	.llseek		= generic_file_llseek,
};
#endif

@@ -2227,6 +2233,7 @@ out_no_task:
static const struct file_operations proc_pid_attr_operations = {
	.read		= proc_pid_attr_read,
	.write		= proc_pid_attr_write,
	.llseek		= generic_file_llseek,
};

static const struct pid_entry attr_dir_stuff[] = {
@@ -2347,6 +2354,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
static const struct file_operations proc_coredump_filter_operations = {
	.read		= proc_coredump_filter_read,
	.write		= proc_coredump_filter_write,
	.llseek		= generic_file_llseek,
};
#endif

+2 −2
Original line number Diff line number Diff line
@@ -232,9 +232,9 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
		if (rv == -ENOIOCTLCMD)
			rv = -EINVAL;
	} 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);
		unlock_kernel();
	}

	pde_users_dec(pde);
+1 −0
Original line number Diff line number Diff line
@@ -558,6 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp)
static const struct file_operations proc_kcore_operations = {
	.read		= read_kcore,
	.open		= open_kcore,
	.llseek		= generic_file_llseek,
};

#ifdef CONFIG_MEMORY_HOTPLUG
Loading