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

* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  uml: Pushdown the bkl from harddog_kern ioctl
  sunrpc: Pushdown the bkl from sunrpc cache ioctl
  sunrpc: Pushdown the bkl from ioctl
  autofs4: Pushdown the bkl from ioctl
  uml: Convert to unlocked_ioctls to remove implicit BKL
  ncpfs: BKL ioctl pushdown
  coda: Clean-up whitespace problems in pioctl.c
  coda: BKL ioctl pushdown
  drivers: Push down BKL into various drivers
  isdn: Push down BKL into ioctl functions
  scsi: Push down BKL into ioctl functions
  dvb: Push down BKL into ioctl functions
  smbfs: Push down BKL into ioctl function
  coda/psdev: Remove BKL from ioctl function
  um/mmapper: Remove BKL usage
  sn_hwperf: Kill BKL usage
  hfsplus: Push down BKL into ioctl function
This commit is contained in:
Linus Torvalds 2010-05-24 08:01:10 -07:00
commit f13771187b
68 changed files with 669 additions and 312 deletions

View file

@ -30,7 +30,6 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/smp_lock.h>
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/mutex.h> #include <linux/mutex.h>
@ -682,8 +681,7 @@ static int sn_hwperf_map_err(int hwperf_err)
/* /*
* ioctl for "sn_hwperf" misc device * ioctl for "sn_hwperf" misc device
*/ */
static int static long sn_hwperf_ioctl(struct file *fp, u32 op, unsigned long arg)
sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
{ {
struct sn_hwperf_ioctl_args a; struct sn_hwperf_ioctl_args a;
struct cpuinfo_ia64 *cdata; struct cpuinfo_ia64 *cdata;
@ -699,8 +697,6 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
int i; int i;
int j; int j;
unlock_kernel();
/* only user requests are allowed here */ /* only user requests are allowed here */
if ((op & SN_HWPERF_OP_MASK) < 10) { if ((op & SN_HWPERF_OP_MASK) < 10) {
r = -EINVAL; r = -EINVAL;
@ -859,12 +855,11 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
error: error:
vfree(p); vfree(p);
lock_kernel();
return r; return r;
} }
static const struct file_operations sn_hwperf_fops = { static const struct file_operations sn_hwperf_fops = {
.ioctl = sn_hwperf_ioctl, .unlocked_ioctl = sn_hwperf_ioctl,
}; };
static struct miscdevice sn_hwperf_dev = { static struct miscdevice sn_hwperf_dev = {

View file

@ -124,8 +124,8 @@ static ssize_t harddog_write(struct file *file, const char __user *data, size_t
return 0; return 0;
} }
static int harddog_ioctl(struct inode *inode, struct file *file, static int harddog_ioctl_unlocked(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp= (void __user *)arg; void __user *argp= (void __user *)arg;
static struct watchdog_info ident = { static struct watchdog_info ident = {
@ -148,10 +148,22 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
} }
} }
static long harddog_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = harddog_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
static const struct file_operations harddog_fops = { static const struct file_operations harddog_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.write = harddog_write, .write = harddog_write,
.ioctl = harddog_ioctl, .unlocked_ioctl = harddog_ioctl,
.open = harddog_open, .open = harddog_open,
.release = harddog_release, .release = harddog_release,
}; };

View file

@ -136,7 +136,7 @@ static unsigned int hostaudio_poll(struct file *file,
return mask; return mask;
} }
static int hostaudio_ioctl(struct inode *inode, struct file *file, static long hostaudio_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct hostaudio_state *state = file->private_data; struct hostaudio_state *state = file->private_data;
@ -223,7 +223,7 @@ static int hostaudio_release(struct inode *inode, struct file *file)
/* /dev/mixer file operations */ /* /dev/mixer file operations */
static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file, static long hostmixer_ioctl_mixdev(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct hostmixer_state *state = file->private_data; struct hostmixer_state *state = file->private_data;
@ -289,7 +289,7 @@ static const struct file_operations hostaudio_fops = {
.read = hostaudio_read, .read = hostaudio_read,
.write = hostaudio_write, .write = hostaudio_write,
.poll = hostaudio_poll, .poll = hostaudio_poll,
.ioctl = hostaudio_ioctl, .unlocked_ioctl = hostaudio_ioctl,
.mmap = NULL, .mmap = NULL,
.open = hostaudio_open, .open = hostaudio_open,
.release = hostaudio_release, .release = hostaudio_release,
@ -298,7 +298,7 @@ static const struct file_operations hostaudio_fops = {
static const struct file_operations hostmixer_fops = { static const struct file_operations hostmixer_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.ioctl = hostmixer_ioctl_mixdev, .unlocked_ioctl = hostmixer_ioctl_mixdev,
.open = hostmixer_open_mixdev, .open = hostmixer_open_mixdev,
.release = hostmixer_release, .release = hostmixer_release,
}; };

View file

@ -46,8 +46,7 @@ static ssize_t mmapper_write(struct file *file, const char __user *buf,
return count; return count;
} }
static int mmapper_ioctl(struct inode *inode, struct file *file, static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
@ -90,7 +89,7 @@ static const struct file_operations mmapper_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = mmapper_read, .read = mmapper_read,
.write = mmapper_write, .write = mmapper_write,
.ioctl = mmapper_ioctl, .unlocked_ioctl = mmapper_ioctl,
.mmap = mmapper_mmap, .mmap = mmapper_mmap,
.open = mmapper_open, .open = mmapper_open,
.release = mmapper_release, .release = mmapper_release,

View file

@ -265,8 +265,8 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait)
* Only when everyone who has opened /dev/apm_bios with write permission * Only when everyone who has opened /dev/apm_bios with write permission
* has acknowledge does the actual suspend happen. * has acknowledge does the actual suspend happen.
*/ */
static int static long
apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) apm_ioctl(struct file *filp, u_int cmd, u_long arg)
{ {
struct apm_user *as = filp->private_data; struct apm_user *as = filp->private_data;
int err = -EINVAL; int err = -EINVAL;
@ -274,6 +274,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
if (!as->suser || !as->writer) if (!as->suser || !as->writer)
return -EPERM; return -EPERM;
lock_kernel();
switch (cmd) { switch (cmd) {
case APM_IOC_SUSPEND: case APM_IOC_SUSPEND:
mutex_lock(&state_lock); mutex_lock(&state_lock);
@ -334,6 +335,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
mutex_unlock(&state_lock); mutex_unlock(&state_lock);
break; break;
} }
unlock_kernel();
return err; return err;
} }
@ -397,7 +399,7 @@ static const struct file_operations apm_bios_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = apm_read, .read = apm_read,
.poll = apm_poll, .poll = apm_poll,
.ioctl = apm_ioctl, .unlocked_ioctl = apm_ioctl,
.open = apm_open, .open = apm_open,
.release = apm_release, .release = apm_release,
}; };

View file

@ -26,6 +26,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/wait.h> #include <linux/wait.h>
@ -106,8 +107,7 @@ static unsigned int DeviceErrorCount; /* number of device error */
static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *); static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *);
static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *); static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *);
static int ac_ioctl(struct inode *, struct file *, unsigned int, static long ac_ioctl(struct file *, unsigned int, unsigned long);
unsigned long);
static irqreturn_t ac_interrupt(int, void *); static irqreturn_t ac_interrupt(int, void *);
static const struct file_operations ac_fops = { static const struct file_operations ac_fops = {
@ -115,7 +115,7 @@ static const struct file_operations ac_fops = {
.llseek = no_llseek, .llseek = no_llseek,
.read = ac_read, .read = ac_read,
.write = ac_write, .write = ac_write,
.ioctl = ac_ioctl, .unlocked_ioctl = ac_ioctl,
}; };
static struct miscdevice ac_miscdev = { static struct miscdevice ac_miscdev = {
@ -689,7 +689,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance)
static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ /* @ ADG ou ATO selon le cas */ { /* @ ADG ou ATO selon le cas */
int i; int i;
@ -711,7 +711,8 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
kfree(adgl); kfree(adgl);
return -EFAULT; return -EFAULT;
} }
lock_kernel();
IndexCard = adgl->num_card-1; IndexCard = adgl->num_card-1;
if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) { if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
@ -721,6 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
warncount--; warncount--;
} }
kfree(adgl); kfree(adgl);
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
@ -838,6 +840,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
} }
Dummy = readb(apbs[IndexCard].RamIO + VERS); Dummy = readb(apbs[IndexCard].RamIO + VERS);
kfree(adgl); kfree(adgl);
unlock_kernel();
return 0; return 0;
} }

View file

@ -232,7 +232,7 @@ ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
} }
static int static int
ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) ds1620_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct therm therm; struct therm therm;
union { union {
@ -316,6 +316,18 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
return 0; return 0;
} }
static long
ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = ds1620_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef THERM_USE_PROC #ifdef THERM_USE_PROC
static int static int
proc_therm_ds1620_read(char *buf, char **start, off_t offset, proc_therm_ds1620_read(char *buf, char **start, off_t offset,
@ -344,7 +356,7 @@ static const struct file_operations ds1620_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = ds1620_open, .open = ds1620_open,
.read = ds1620_read, .read = ds1620_read,
.ioctl = ds1620_ioctl, .unlocked_ioctl = ds1620_unlocked_ioctl,
}; };
static struct miscdevice ds1620_miscdev = { static struct miscdevice ds1620_miscdev = {

View file

@ -93,8 +93,8 @@ static ssize_t dtlk_write(struct file *, const char __user *,
static unsigned int dtlk_poll(struct file *, poll_table *); static unsigned int dtlk_poll(struct file *, poll_table *);
static int dtlk_open(struct inode *, struct file *); static int dtlk_open(struct inode *, struct file *);
static int dtlk_release(struct inode *, struct file *); static int dtlk_release(struct inode *, struct file *);
static int dtlk_ioctl(struct inode *inode, struct file *file, static long dtlk_ioctl(struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static const struct file_operations dtlk_fops = static const struct file_operations dtlk_fops =
{ {
@ -102,7 +102,7 @@ static const struct file_operations dtlk_fops =
.read = dtlk_read, .read = dtlk_read,
.write = dtlk_write, .write = dtlk_write,
.poll = dtlk_poll, .poll = dtlk_poll,
.ioctl = dtlk_ioctl, .unlocked_ioctl = dtlk_ioctl,
.open = dtlk_open, .open = dtlk_open,
.release = dtlk_release, .release = dtlk_release,
}; };
@ -263,10 +263,9 @@ static void dtlk_timer_tick(unsigned long data)
wake_up_interruptible(&dtlk_process_list); wake_up_interruptible(&dtlk_process_list);
} }
static int dtlk_ioctl(struct inode *inode, static long dtlk_ioctl(struct file *file,
struct file *file, unsigned int cmd,
unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
char __user *argp = (char __user *)arg; char __user *argp = (char __user *)arg;
struct dtlk_settings *sp; struct dtlk_settings *sp;
@ -276,7 +275,9 @@ static int dtlk_ioctl(struct inode *inode,
switch (cmd) { switch (cmd) {
case DTLK_INTERROGATE: case DTLK_INTERROGATE:
lock_kernel();
sp = dtlk_interrogate(); sp = dtlk_interrogate();
unlock_kernel();
if (copy_to_user(argp, sp, sizeof(struct dtlk_settings))) if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
return -EINVAL; return -EINVAL;
return 0; return 0;

View file

@ -19,6 +19,7 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/nvram.h> #include <asm/nvram.h>
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
@ -84,8 +85,7 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
return p - buf; return p - buf;
} }
static int nvram_ioctl(struct inode *inode, struct file *file, static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
switch(cmd) { switch(cmd) {
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
@ -116,12 +116,23 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = nvram_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
const struct file_operations nvram_fops = { const struct file_operations nvram_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = nvram_llseek, .llseek = nvram_llseek,
.read = read_nvram, .read = read_nvram,
.write = write_nvram, .write = write_nvram,
.ioctl = nvram_ioctl, .unlocked_ioctl = nvram_unlocked_ioctl,
}; };
static struct miscdevice nvram_dev = { static struct miscdevice nvram_dev = {

View file

@ -262,7 +262,7 @@ static inline int gen_set_rtc_irq_bit(unsigned char bit)
#endif #endif
} }
static int gen_rtc_ioctl(struct inode *inode, struct file *file, static int gen_rtc_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct rtc_time wtime; struct rtc_time wtime;
@ -332,6 +332,18 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
return -EINVAL; return -EINVAL;
} }
static long gen_rtc_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int ret;
lock_kernel();
ret = gen_rtc_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
/* /*
* We enforce only one user at a time here with the open/close. * We enforce only one user at a time here with the open/close.
* Also clear the previous interrupt data on an open, and clean * Also clear the previous interrupt data on an open, and clean
@ -482,7 +494,7 @@ static const struct file_operations gen_rtc_fops = {
.read = gen_rtc_read, .read = gen_rtc_read,
.poll = gen_rtc_poll, .poll = gen_rtc_poll,
#endif #endif
.ioctl = gen_rtc_ioctl, .unlocked_ioctl = gen_rtc_unlocked_ioctl,
.open = gen_rtc_open, .open = gen_rtc_open,
.release = gen_rtc_release, .release = gen_rtc_release,
}; };

View file

@ -431,14 +431,18 @@ static int hpet_release(struct inode *inode, struct file *file)
static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int);
static int static long hpet_ioctl(struct file *file, unsigned int cmd,
hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
struct hpet_dev *devp; struct hpet_dev *devp;
int ret;
devp = file->private_data; devp = file->private_data;
return hpet_ioctl_common(devp, cmd, arg, 0); lock_kernel();
ret = hpet_ioctl_common(devp, cmd, arg, 0);
unlock_kernel();
return ret;
} }
static int hpet_ioctl_ieon(struct hpet_dev *devp) static int hpet_ioctl_ieon(struct hpet_dev *devp)
@ -654,7 +658,7 @@ static const struct file_operations hpet_fops = {
.llseek = no_llseek, .llseek = no_llseek,
.read = hpet_read, .read = hpet_read,
.poll = hpet_poll, .poll = hpet_poll,
.ioctl = hpet_ioctl, .unlocked_ioctl = hpet_ioctl,
.open = hpet_open, .open = hpet_open,
.release = hpet_release, .release = hpet_release,
.fasync = hpet_fasync, .fasync = hpet_fasync,

View file

@ -228,8 +228,7 @@ static int handle_send_req(ipmi_user_t user,
return rv; return rv;
} }
static int ipmi_ioctl(struct inode *inode, static int ipmi_ioctl(struct file *file,
struct file *file,
unsigned int cmd, unsigned int cmd,
unsigned long data) unsigned long data)
{ {
@ -630,6 +629,23 @@ static int ipmi_ioctl(struct inode *inode,
return rv; return rv;
} }
/*
* Note: it doesn't make sense to take the BKL here but
* not in compat_ipmi_ioctl. -arnd
*/
static long ipmi_unlocked_ioctl(struct file *file,
unsigned int cmd,
unsigned long data)
{
int ret;
lock_kernel();
ret = ipmi_ioctl(file, cmd, data);
unlock_kernel();
return ret;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
/* /*
@ -802,7 +818,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
if (copy_to_user(precv64, &recv64, sizeof(recv64))) if (copy_to_user(precv64, &recv64, sizeof(recv64)))
return -EFAULT; return -EFAULT;
rc = ipmi_ioctl(filep->f_path.dentry->d_inode, filep, rc = ipmi_ioctl(filep,
((cmd == COMPAT_IPMICTL_RECEIVE_MSG) ((cmd == COMPAT_IPMICTL_RECEIVE_MSG)
? IPMICTL_RECEIVE_MSG ? IPMICTL_RECEIVE_MSG
: IPMICTL_RECEIVE_MSG_TRUNC), : IPMICTL_RECEIVE_MSG_TRUNC),
@ -819,14 +835,14 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
return rc; return rc;
} }
default: default:
return ipmi_ioctl(filep->f_path.dentry->d_inode, filep, cmd, arg); return ipmi_ioctl(filep, cmd, arg);
} }
} }
#endif #endif
static const struct file_operations ipmi_fops = { static const struct file_operations ipmi_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = ipmi_ioctl, .unlocked_ioctl = ipmi_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = compat_ipmi_ioctl, .compat_ioctl = compat_ipmi_ioctl,
#endif #endif

View file

@ -659,7 +659,7 @@ static struct watchdog_info ident = {
.identity = "IPMI" .identity = "IPMI"
}; };
static int ipmi_ioctl(struct inode *inode, struct file *file, static int ipmi_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
@ -730,6 +730,19 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
} }
} }
static long ipmi_unlocked_ioctl(struct file *file,
unsigned int cmd,
unsigned long arg)
{
int ret;
lock_kernel();
ret = ipmi_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
static ssize_t ipmi_write(struct file *file, static ssize_t ipmi_write(struct file *file,
const char __user *buf, const char __user *buf,
size_t len, size_t len,
@ -880,7 +893,7 @@ static const struct file_operations ipmi_wdog_fops = {
.read = ipmi_read, .read = ipmi_read,
.poll = ipmi_poll, .poll = ipmi_poll,
.write = ipmi_write, .write = ipmi_write,
.ioctl = ipmi_ioctl, .unlocked_ioctl = ipmi_unlocked_ioctl,
.open = ipmi_open, .open = ipmi_open,
.release = ipmi_close, .release = ipmi_close,
.fasync = ipmi_fasync, .fasync = ipmi_fasync,

View file

@ -296,8 +296,8 @@ checksum_err:
return -EIO; return -EIO;
} }
static int nvram_ioctl(struct inode *inode, struct file *file, static long nvram_ioctl(struct file *file, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
int i; int i;
@ -308,6 +308,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
lock_kernel();
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
for (i = 0; i < NVRAM_BYTES; ++i) for (i = 0; i < NVRAM_BYTES; ++i)
@ -315,6 +316,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
__nvram_set_checksum(); __nvram_set_checksum();
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
unlock_kernel();
return 0; return 0;
case NVRAM_SETCKS: case NVRAM_SETCKS:
@ -323,9 +325,11 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
lock_kernel();
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
__nvram_set_checksum(); __nvram_set_checksum();
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
unlock_kernel();
return 0; return 0;
default: default:
@ -422,7 +426,7 @@ static const struct file_operations nvram_fops = {
.llseek = nvram_llseek, .llseek = nvram_llseek,
.read = nvram_read, .read = nvram_read,
.write = nvram_write, .write = nvram_write,
.ioctl = nvram_ioctl, .unlocked_ioctl = nvram_ioctl,
.open = nvram_open, .open = nvram_open,
.release = nvram_release, .release = nvram_release,
}; };

View file

@ -94,8 +94,9 @@ static int get_flash_id(void)
return c2; return c2;
} }
static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg) static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{ {
lock_kernel();
switch (cmd) { switch (cmd) {
case CMD_WRITE_DISABLE: case CMD_WRITE_DISABLE:
gbWriteBase64Enable = 0; gbWriteBase64Enable = 0;
@ -113,8 +114,10 @@ static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cm
default: default:
gbWriteBase64Enable = 0; gbWriteBase64Enable = 0;
gbWriteEnable = 0; gbWriteEnable = 0;
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
unlock_kernel();
return 0; return 0;
} }
@ -631,7 +634,7 @@ static const struct file_operations flash_fops =
.llseek = flash_llseek, .llseek = flash_llseek,
.read = flash_read, .read = flash_read,
.write = flash_write, .write = flash_write,
.ioctl = flash_ioctl, .unlocked_ioctl = flash_ioctl,
}; };
static struct miscdevice flash_miscdev = static struct miscdevice flash_miscdev =

View file

@ -121,13 +121,17 @@ static int raw_release(struct inode *inode, struct file *filp)
/* /*
* Forward ioctls to the underlying block device. * Forward ioctls to the underlying block device.
*/ */
static int static long
raw_ioctl(struct inode *inode, struct file *filp, raw_ioctl(struct file *filp, unsigned int command, unsigned long arg)
unsigned int command, unsigned long arg)
{ {
struct block_device *bdev = filp->private_data; struct block_device *bdev = filp->private_data;
int ret;
return blkdev_ioctl(bdev, 0, command, arg); lock_kernel();
ret = blkdev_ioctl(bdev, 0, command, arg);
unlock_kernel();
return ret;
} }
static void bind_device(struct raw_config_request *rq) static void bind_device(struct raw_config_request *rq)
@ -141,13 +145,14 @@ static void bind_device(struct raw_config_request *rq)
* Deal with ioctls against the raw-device control interface, to bind * Deal with ioctls against the raw-device control interface, to bind
* and unbind other raw devices. * and unbind other raw devices.
*/ */
static int raw_ctl_ioctl(struct inode *inode, struct file *filp, static long raw_ctl_ioctl(struct file *filp, unsigned int command,
unsigned int command, unsigned long arg) unsigned long arg)
{ {
struct raw_config_request rq; struct raw_config_request rq;
struct raw_device_data *rawdev; struct raw_device_data *rawdev;
int err = 0; int err = 0;
lock_kernel();
switch (command) { switch (command) {
case RAW_SETBIND: case RAW_SETBIND:
case RAW_GETBIND: case RAW_GETBIND:
@ -240,25 +245,26 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
break; break;
} }
out: out:
unlock_kernel();
return err; return err;
} }
static const struct file_operations raw_fops = { static const struct file_operations raw_fops = {
.read = do_sync_read, .read = do_sync_read,
.aio_read = generic_file_aio_read, .aio_read = generic_file_aio_read,
.write = do_sync_write, .write = do_sync_write,
.aio_write = blkdev_aio_write, .aio_write = blkdev_aio_write,
.fsync = blkdev_fsync, .fsync = blkdev_fsync,
.open = raw_open, .open = raw_open,
.release= raw_release, .release = raw_release,
.ioctl = raw_ioctl, .unlocked_ioctl = raw_ioctl,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static const struct file_operations raw_ctl_fops = { static const struct file_operations raw_ctl_fops = {
.ioctl = raw_ctl_ioctl, .unlocked_ioctl = raw_ctl_ioctl,
.open = raw_open, .open = raw_open,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static struct cdev raw_cdev; static struct cdev raw_cdev;

View file

@ -38,6 +38,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h> #include <linux/hwmon-sysfs.h>
#include <linux/smp_lock.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
@ -847,8 +848,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
return count; return count;
} }
static int watchdog_ioctl(struct inode *inode, struct file *filp, static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
@ -858,6 +858,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
int i, ret = 0; int i, ret = 0;
struct fschmd_data *data = filp->private_data; struct fschmd_data *data = filp->private_data;
lock_kernel();
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
ident.firmware_version = data->revision; ident.firmware_version = data->revision;
@ -914,7 +915,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
default: default:
ret = -ENOTTY; ret = -ENOTTY;
} }
unlock_kernel();
return ret; return ret;
} }
@ -924,7 +925,7 @@ static const struct file_operations watchdog_fops = {
.open = watchdog_open, .open = watchdog_open,
.release = watchdog_release, .release = watchdog_release,
.write = watchdog_write, .write = watchdog_write,
.ioctl = watchdog_ioctl, .unlocked_ioctl = watchdog_ioctl,
}; };

View file

@ -35,6 +35,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/smp_lock.h>
#include <linux/hwmon-vid.h> #include <linux/hwmon-vid.h>
#include <linux/hwmon-sysfs.h> #include <linux/hwmon-sysfs.h>
#include <linux/err.h> #include <linux/err.h>
@ -1319,8 +1320,8 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
return count; return count;
} }
static int watchdog_ioctl(struct inode *inode, struct file *filp, static long watchdog_ioctl(struct file *filp, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
@ -1332,6 +1333,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
int val, ret = 0; int val, ret = 0;
struct w83793_data *data = filp->private_data; struct w83793_data *data = filp->private_data;
lock_kernel();
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (!nowayout) if (!nowayout)
@ -1385,7 +1387,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
default: default:
ret = -ENOTTY; ret = -ENOTTY;
} }
unlock_kernel();
return ret; return ret;
} }
@ -1395,7 +1397,7 @@ static const struct file_operations watchdog_fops = {
.open = watchdog_open, .open = watchdog_open,
.release = watchdog_close, .release = watchdog_close,
.write = watchdog_write, .write = watchdog_write,
.ioctl = watchdog_ioctl, .unlocked_ioctl = watchdog_ioctl,
}; };
/* /*

View file

@ -43,6 +43,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/smp_lock.h>
#include <linux/semaphore.h> #include <linux/semaphore.h>
MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>");
@ -64,8 +65,8 @@ static DECLARE_WAIT_QUEUE_HEAD(hp_sdc_rtc_wait);
static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf, static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, static long hp_sdc_rtc_unlocked_ioctl(struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait); static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait);
@ -512,7 +513,7 @@ static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
return len; return len;
} }
static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, static int hp_sdc_rtc_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
#if 1 #if 1
@ -659,14 +660,27 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
#endif #endif
} }
static long hp_sdc_rtc_unlocked_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = hp_sdc_rtc_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
static const struct file_operations hp_sdc_rtc_fops = { static const struct file_operations hp_sdc_rtc_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.read = hp_sdc_rtc_read, .read = hp_sdc_rtc_read,
.poll = hp_sdc_rtc_poll, .poll = hp_sdc_rtc_poll,
.ioctl = hp_sdc_rtc_ioctl, .unlocked_ioctl = hp_sdc_rtc_ioctl,
.open = hp_sdc_rtc_open, .open = hp_sdc_rtc_open,
.fasync = hp_sdc_rtc_fasync, .fasync = hp_sdc_rtc_fasync,
}; };
static struct miscdevice hp_sdc_rtc_dev = { static struct miscdevice hp_sdc_rtc_dev = {

View file

@ -787,8 +787,7 @@ capi_poll(struct file *file, poll_table * wait)
} }
static int static int
capi_ioctl(struct inode *inode, struct file *file, capi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct capidev *cdev = file->private_data; struct capidev *cdev = file->private_data;
capi_ioctl_struct data; capi_ioctl_struct data;
@ -981,6 +980,18 @@ register_out:
} }
} }
static long
capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = capi_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
static int capi_open(struct inode *inode, struct file *file) static int capi_open(struct inode *inode, struct file *file)
{ {
struct capidev *cdev; struct capidev *cdev;
@ -1026,7 +1037,7 @@ static const struct file_operations capi_fops =
.read = capi_read, .read = capi_read,
.write = capi_write, .write = capi_write,
.poll = capi_poll, .poll = capi_poll,
.ioctl = capi_ioctl, .unlocked_ioctl = capi_unlocked_ioctl,
.open = capi_open, .open = capi_open,
.release = capi_release, .release = capi_release,
}; };

View file

@ -1272,9 +1272,9 @@ isdn_poll(struct file *file, poll_table * wait)
static int static int
isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) isdn_ioctl(struct file *file, uint cmd, ulong arg)
{ {
uint minor = iminor(inode); uint minor = iminor(file->f_path.dentry->d_inode);
isdn_ctrl c; isdn_ctrl c;
int drvidx; int drvidx;
int chidx; int chidx;
@ -1722,6 +1722,18 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
#undef cfg #undef cfg
} }
static long
isdn_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = isdn_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
/* /*
* Open the device code. * Open the device code.
*/ */
@ -1838,7 +1850,7 @@ static const struct file_operations isdn_fops =
.read = isdn_read, .read = isdn_read,
.write = isdn_write, .write = isdn_write,
.poll = isdn_poll, .poll = isdn_poll,
.ioctl = isdn_ioctl, .unlocked_ioctl = isdn_unlocked_ioctl,
.open = isdn_open, .open = isdn_open,
.release = isdn_close, .release = isdn_close,
}; };

View file

@ -24,6 +24,7 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mISDNif.h> #include <linux/mISDNif.h>
#include <linux/smp_lock.h>
#include "core.h" #include "core.h"
static u_int *debug; static u_int *debug;
@ -215,9 +216,8 @@ unlock:
return ret; return ret;
} }
static int static long
mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
struct mISDNtimerdev *dev = filep->private_data; struct mISDNtimerdev *dev = filep->private_data;
int id, tout, ret = 0; int id, tout, ret = 0;
@ -226,6 +226,7 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
if (*debug & DEBUG_TIMER) if (*debug & DEBUG_TIMER)
printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__, printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__,
filep, cmd, arg); filep, cmd, arg);
lock_kernel();
switch (cmd) { switch (cmd) {
case IMADDTIMER: case IMADDTIMER:
if (get_user(tout, (int __user *)arg)) { if (get_user(tout, (int __user *)arg)) {
@ -257,13 +258,14 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
default: default:
ret = -EINVAL; ret = -EINVAL;
} }
unlock_kernel();
return ret; return ret;
} }
static const struct file_operations mISDN_fops = { static const struct file_operations mISDN_fops = {
.read = mISDN_read, .read = mISDN_read,
.poll = mISDN_poll, .poll = mISDN_poll,
.ioctl = mISDN_ioctl, .unlocked_ioctl = mISDN_ioctl,
.open = mISDN_open, .open = mISDN_open,
.release = mISDN_close, .release = mISDN_close,
}; };

View file

@ -100,7 +100,7 @@ const struct file_operations nvram_fops = {
.llseek = nvram_llseek, .llseek = nvram_llseek,
.read = read_nvram, .read = read_nvram,
.write = write_nvram, .write = write_nvram,
.ioctl = nvram_ioctl, .unlocked_ioctl = nvram_ioctl,
}; };
static struct miscdevice nvram_dev = { static struct miscdevice nvram_dev = {

View file

@ -2273,8 +2273,7 @@ static int register_pmu_pm_ops(void)
device_initcall(register_pmu_pm_ops); device_initcall(register_pmu_pm_ops);
#endif #endif
static int static int pmu_ioctl(struct file *filp,
pmu_ioctl(struct inode * inode, struct file *filp,
u_int cmd, u_long arg) u_int cmd, u_long arg)
{ {
__u32 __user *argp = (__u32 __user *)arg; __u32 __user *argp = (__u32 __user *)arg;
@ -2337,11 +2336,23 @@ pmu_ioctl(struct inode * inode, struct file *filp,
return error; return error;
} }
static long pmu_unlocked_ioctl(struct file *filp,
u_int cmd, u_long arg)
{
int ret;
lock_kernel();
ret = pmu_ioctl(filp, cmd, arg);
unlock_kernel();
return ret;
}
static const struct file_operations pmu_device_fops = { static const struct file_operations pmu_device_fops = {
.read = pmu_read, .read = pmu_read,
.write = pmu_write, .write = pmu_write,
.poll = pmu_fpoll, .poll = pmu_fpoll,
.ioctl = pmu_ioctl, .unlocked_ioctl = pmu_unlocked_ioctl,
.open = pmu_open, .open = pmu_open,
.release = pmu_release, .release = pmu_release,
}; };

View file

@ -25,6 +25,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <linux/wait.h> #include <linux/wait.h>
@ -963,7 +964,7 @@ dvb_demux_read(struct file *file, char __user *buf, size_t count,
return ret; return ret;
} }
static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, static int dvb_demux_do_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dmxdev_filter *dmxdevfilter = file->private_data; struct dmxdev_filter *dmxdevfilter = file->private_data;
@ -1084,10 +1085,16 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
} }
static int dvb_demux_ioctl(struct inode *inode, struct file *file, static long dvb_demux_ioctl(struct file *file, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
return dvb_usercopy(inode, file, cmd, arg, dvb_demux_do_ioctl); int ret;
lock_kernel();
ret = dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl);
unlock_kernel();
return ret;
} }
static unsigned int dvb_demux_poll(struct file *file, poll_table *wait) static unsigned int dvb_demux_poll(struct file *file, poll_table *wait)
@ -1139,7 +1146,7 @@ static int dvb_demux_release(struct inode *inode, struct file *file)
static const struct file_operations dvb_demux_fops = { static const struct file_operations dvb_demux_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = dvb_demux_read, .read = dvb_demux_read,
.ioctl = dvb_demux_ioctl, .unlocked_ioctl = dvb_demux_ioctl,
.open = dvb_demux_open, .open = dvb_demux_open,
.release = dvb_demux_release, .release = dvb_demux_release,
.poll = dvb_demux_poll, .poll = dvb_demux_poll,
@ -1152,7 +1159,7 @@ static struct dvb_device dvbdev_demux = {
.fops = &dvb_demux_fops .fops = &dvb_demux_fops
}; };
static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file, static int dvb_dvr_do_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1176,10 +1183,16 @@ static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
} }
static int dvb_dvr_ioctl(struct inode *inode, struct file *file, static long dvb_dvr_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return dvb_usercopy(inode, file, cmd, arg, dvb_dvr_do_ioctl); int ret;
lock_kernel();
ret = dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl);
unlock_kernel();
return ret;
} }
static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
@ -1208,7 +1221,7 @@ static const struct file_operations dvb_dvr_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = dvb_dvr_read, .read = dvb_dvr_read,
.write = dvb_dvr_write, .write = dvb_dvr_write,
.ioctl = dvb_dvr_ioctl, .unlocked_ioctl = dvb_dvr_ioctl,
.open = dvb_dvr_open, .open = dvb_dvr_open,
.release = dvb_dvr_release, .release = dvb_dvr_release,
.poll = dvb_dvr_poll, .poll = dvb_dvr_poll,

View file

@ -36,6 +36,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include "dvb_ca_en50221.h" #include "dvb_ca_en50221.h"
@ -1181,7 +1182,7 @@ static int dvb_ca_en50221_thread(void *data)
* *
* @return 0 on success, <0 on error. * @return 0 on success, <0 on error.
*/ */
static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file, static int dvb_ca_en50221_io_do_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1255,10 +1256,16 @@ static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file,
* *
* @return 0 on success, <0 on error. * @return 0 on success, <0 on error.
*/ */
static int dvb_ca_en50221_io_ioctl(struct inode *inode, struct file *file, static long dvb_ca_en50221_io_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return dvb_usercopy(inode, file, cmd, arg, dvb_ca_en50221_io_do_ioctl); int ret;
lock_kernel();
ret = dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl);
unlock_kernel();
return ret;
} }
@ -1611,7 +1618,7 @@ static const struct file_operations dvb_ca_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = dvb_ca_en50221_io_read, .read = dvb_ca_en50221_io_read,
.write = dvb_ca_en50221_io_write, .write = dvb_ca_en50221_io_write,
.ioctl = dvb_ca_en50221_io_ioctl, .unlocked_ioctl = dvb_ca_en50221_io_ioctl,
.open = dvb_ca_en50221_io_open, .open = dvb_ca_en50221_io_open,
.release = dvb_ca_en50221_io_release, .release = dvb_ca_en50221_io_release,
.poll = dvb_ca_en50221_io_poll, .poll = dvb_ca_en50221_io_poll,

View file

@ -36,6 +36,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/smp_lock.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <asm/processor.h> #include <asm/processor.h>
@ -1195,14 +1196,14 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe)
} }
} }
static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, static int dvb_frontend_ioctl_legacy(struct file *file,
unsigned int cmd, void *parg); unsigned int cmd, void *parg);
static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, static int dvb_frontend_ioctl_properties(struct file *file,
unsigned int cmd, void *parg); unsigned int cmd, void *parg);
static int dtv_property_process_get(struct dvb_frontend *fe, static int dtv_property_process_get(struct dvb_frontend *fe,
struct dtv_property *tvp, struct dtv_property *tvp,
struct inode *inode, struct file *file) struct file *file)
{ {
int r = 0; int r = 0;
@ -1335,7 +1336,6 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
static int dtv_property_process_set(struct dvb_frontend *fe, static int dtv_property_process_set(struct dvb_frontend *fe,
struct dtv_property *tvp, struct dtv_property *tvp,
struct inode *inode,
struct file *file) struct file *file)
{ {
int r = 0; int r = 0;
@ -1366,7 +1366,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
dprintk("%s() Finalised property cache\n", __func__); dprintk("%s() Finalised property cache\n", __func__);
dtv_property_cache_submit(fe); dtv_property_cache_submit(fe);
r |= dvb_frontend_ioctl_legacy(inode, file, FE_SET_FRONTEND, r |= dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND,
&fepriv->parameters); &fepriv->parameters);
break; break;
case DTV_FREQUENCY: case DTV_FREQUENCY:
@ -1398,12 +1398,12 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
break; break;
case DTV_VOLTAGE: case DTV_VOLTAGE:
fe->dtv_property_cache.voltage = tvp->u.data; fe->dtv_property_cache.voltage = tvp->u.data;
r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_VOLTAGE, r = dvb_frontend_ioctl_legacy(file, FE_SET_VOLTAGE,
(void *)fe->dtv_property_cache.voltage); (void *)fe->dtv_property_cache.voltage);
break; break;
case DTV_TONE: case DTV_TONE:
fe->dtv_property_cache.sectone = tvp->u.data; fe->dtv_property_cache.sectone = tvp->u.data;
r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_TONE, r = dvb_frontend_ioctl_legacy(file, FE_SET_TONE,
(void *)fe->dtv_property_cache.sectone); (void *)fe->dtv_property_cache.sectone);
break; break;
case DTV_CODE_RATE_HP: case DTV_CODE_RATE_HP:
@ -1487,7 +1487,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
return r; return r;
} }
static int dvb_frontend_ioctl(struct inode *inode, struct file *file, static int dvb_frontend_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1509,17 +1509,17 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
return -ERESTARTSYS; return -ERESTARTSYS;
if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY)) if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY))
err = dvb_frontend_ioctl_properties(inode, file, cmd, parg); err = dvb_frontend_ioctl_properties(file, cmd, parg);
else { else {
fe->dtv_property_cache.state = DTV_UNDEFINED; fe->dtv_property_cache.state = DTV_UNDEFINED;
err = dvb_frontend_ioctl_legacy(inode, file, cmd, parg); err = dvb_frontend_ioctl_legacy(file, cmd, parg);
} }
up(&fepriv->sem); up(&fepriv->sem);
return err; return err;
} }
static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, static int dvb_frontend_ioctl_properties(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1555,7 +1555,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file,
} }
for (i = 0; i < tvps->num; i++) { for (i = 0; i < tvps->num; i++) {
(tvp + i)->result = dtv_property_process_set(fe, tvp + i, inode, file); (tvp + i)->result = dtv_property_process_set(fe, tvp + i, file);
err |= (tvp + i)->result; err |= (tvp + i)->result;
} }
@ -1587,7 +1587,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file,
} }
for (i = 0; i < tvps->num; i++) { for (i = 0; i < tvps->num; i++) {
(tvp + i)->result = dtv_property_process_get(fe, tvp + i, inode, file); (tvp + i)->result = dtv_property_process_get(fe, tvp + i, file);
err |= (tvp + i)->result; err |= (tvp + i)->result;
} }
@ -1604,7 +1604,7 @@ out:
return err; return err;
} }
static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, static int dvb_frontend_ioctl_legacy(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -2031,7 +2031,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
static const struct file_operations dvb_frontend_fops = { static const struct file_operations dvb_frontend_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = dvb_generic_ioctl, .unlocked_ioctl = dvb_generic_ioctl,
.poll = dvb_frontend_poll, .poll = dvb_frontend_poll,
.open = dvb_frontend_open, .open = dvb_frontend_open,
.release = dvb_frontend_release .release = dvb_frontend_release

View file

@ -59,6 +59,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/dvb/net.h> #include <linux/dvb/net.h>
#include <linux/smp_lock.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/crc32.h> #include <linux/crc32.h>
@ -1329,7 +1330,7 @@ static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned long num)
return 0; return 0;
} }
static int dvb_net_do_ioctl(struct inode *inode, struct file *file, static int dvb_net_do_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1431,10 +1432,16 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
static int dvb_net_ioctl(struct inode *inode, struct file *file, static long dvb_net_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return dvb_usercopy(inode, file, cmd, arg, dvb_net_do_ioctl); int ret;
lock_kernel();
ret = dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
unlock_kernel();
return ret;
} }
static int dvb_net_close(struct inode *inode, struct file *file) static int dvb_net_close(struct inode *inode, struct file *file)
@ -1455,7 +1462,7 @@ static int dvb_net_close(struct inode *inode, struct file *file)
static const struct file_operations dvb_net_fops = { static const struct file_operations dvb_net_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = dvb_net_ioctl, .unlocked_ioctl = dvb_net_ioctl,
.open = dvb_generic_open, .open = dvb_generic_open,
.release = dvb_net_close, .release = dvb_net_close,
}; };

View file

@ -154,10 +154,11 @@ int dvb_generic_release(struct inode *inode, struct file *file)
EXPORT_SYMBOL(dvb_generic_release); EXPORT_SYMBOL(dvb_generic_release);
int dvb_generic_ioctl(struct inode *inode, struct file *file, long dvb_generic_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
int ret;
if (!dvbdev) if (!dvbdev)
return -ENODEV; return -ENODEV;
@ -165,7 +166,11 @@ int dvb_generic_ioctl(struct inode *inode, struct file *file,
if (!dvbdev->kernel_ioctl) if (!dvbdev->kernel_ioctl)
return -EINVAL; return -EINVAL;
return dvb_usercopy (inode, file, cmd, arg, dvbdev->kernel_ioctl); lock_kernel();
ret = dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
unlock_kernel();
return ret;
} }
EXPORT_SYMBOL(dvb_generic_ioctl); EXPORT_SYMBOL(dvb_generic_ioctl);
@ -377,9 +382,9 @@ EXPORT_SYMBOL(dvb_unregister_adapter);
define this as video_usercopy(). this will introduce a dependecy define this as video_usercopy(). this will introduce a dependecy
to the v4l "videodev.o" module, which is unnecessary for some to the v4l "videodev.o" module, which is unnecessary for some
cards (ie. the budget dvb-cards don't need the v4l module...) */ cards (ie. the budget dvb-cards don't need the v4l module...) */
int dvb_usercopy(struct inode *inode, struct file *file, int dvb_usercopy(struct file *file,
unsigned int cmd, unsigned long arg, unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file, int (*func)(struct file *file,
unsigned int cmd, void *arg)) unsigned int cmd, void *arg))
{ {
char sbuf[128]; char sbuf[128];
@ -416,7 +421,7 @@ int dvb_usercopy(struct inode *inode, struct file *file,
} }
/* call driver */ /* call driver */
if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD) if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
err = -EINVAL; err = -EINVAL;
if (err < 0) if (err < 0)

View file

@ -116,8 +116,7 @@ struct dvb_device {
wait_queue_head_t wait_queue; wait_queue_head_t wait_queue;
/* don't really need those !? -- FIXME: use video_usercopy */ /* don't really need those !? -- FIXME: use video_usercopy */
int (*kernel_ioctl)(struct inode *inode, struct file *file, int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
unsigned int cmd, void *arg);
void *priv; void *priv;
}; };
@ -138,17 +137,15 @@ extern void dvb_unregister_device (struct dvb_device *dvbdev);
extern int dvb_generic_open (struct inode *inode, struct file *file); extern int dvb_generic_open (struct inode *inode, struct file *file);
extern int dvb_generic_release (struct inode *inode, struct file *file); extern int dvb_generic_release (struct inode *inode, struct file *file);
extern int dvb_generic_ioctl (struct inode *inode, struct file *file, extern long dvb_generic_ioctl (struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
/* we don't mess with video_usercopy() any more, /* we don't mess with video_usercopy() any more,
we simply define out own dvb_usercopy(), which will hopefully become we simply define out own dvb_usercopy(), which will hopefully become
generic_usercopy() someday... */ generic_usercopy() someday... */
extern int dvb_usercopy(struct inode *inode, struct file *file, extern int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
unsigned int cmd, unsigned long arg, int (*func)(struct file *file, unsigned int cmd, void *arg));
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg));
/** generic DVB attach function. */ /** generic DVB attach function. */
#ifdef CONFIG_MEDIA_ATTACH #ifdef CONFIG_MEDIA_ATTACH

View file

@ -175,8 +175,7 @@ static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)
return err; return err;
} }
static int fdtv_ca_ioctl(struct inode *inode, struct file *file, static int fdtv_ca_ioctl(struct file *file, unsigned int cmd, void *arg)
unsigned int cmd, void *arg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
struct firedtv *fdtv = dvbdev->priv; struct firedtv *fdtv = dvbdev->priv;
@ -217,7 +216,7 @@ static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait)
static const struct file_operations fdtv_ca_fops = { static const struct file_operations fdtv_ca_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = dvb_generic_ioctl, .unlocked_ioctl = dvb_generic_ioctl,
.open = dvb_generic_open, .open = dvb_generic_open,
.release = dvb_generic_release, .release = dvb_generic_release,
.poll = fdtv_ca_io_poll, .poll = fdtv_ca_io_poll,

View file

@ -708,7 +708,7 @@ static void gpioirq(unsigned long cookie)
#ifdef CONFIG_DVB_AV7110_OSD #ifdef CONFIG_DVB_AV7110_OSD
static int dvb_osd_ioctl(struct inode *inode, struct file *file, static int dvb_osd_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -727,7 +727,7 @@ static int dvb_osd_ioctl(struct inode *inode, struct file *file,
static const struct file_operations dvb_osd_fops = { static const struct file_operations dvb_osd_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = dvb_generic_ioctl, .unlocked_ioctl = dvb_generic_ioctl,
.open = dvb_generic_open, .open = dvb_generic_open,
.release = dvb_generic_release, .release = dvb_generic_release,
}; };

View file

@ -1089,7 +1089,7 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
} }
static int dvb_video_ioctl(struct inode *inode, struct file *file, static int dvb_video_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1297,7 +1297,7 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
} }
static int dvb_audio_ioctl(struct inode *inode, struct file *file, static int dvb_audio_ioctl(struct file *file,
unsigned int cmd, void *parg) unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
@ -1517,7 +1517,7 @@ static int dvb_audio_release(struct inode *inode, struct file *file)
static const struct file_operations dvb_video_fops = { static const struct file_operations dvb_video_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.write = dvb_video_write, .write = dvb_video_write,
.ioctl = dvb_generic_ioctl, .unlocked_ioctl = dvb_generic_ioctl,
.open = dvb_video_open, .open = dvb_video_open,
.release = dvb_video_release, .release = dvb_video_release,
.poll = dvb_video_poll, .poll = dvb_video_poll,
@ -1535,7 +1535,7 @@ static struct dvb_device dvbdev_video = {
static const struct file_operations dvb_audio_fops = { static const struct file_operations dvb_audio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.write = dvb_audio_write, .write = dvb_audio_write,
.ioctl = dvb_generic_ioctl, .unlocked_ioctl = dvb_generic_ioctl,
.open = dvb_audio_open, .open = dvb_audio_open,
.release = dvb_audio_release, .release = dvb_audio_release,
.poll = dvb_audio_poll, .poll = dvb_audio_poll,

View file

@ -248,8 +248,7 @@ static unsigned int dvb_ca_poll (struct file *file, poll_table *wait)
return mask; return mask;
} }
static int dvb_ca_ioctl(struct inode *inode, struct file *file, static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
unsigned int cmd, void *parg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
struct av7110 *av7110 = dvbdev->priv; struct av7110 *av7110 = dvbdev->priv;
@ -350,7 +349,7 @@ static const struct file_operations dvb_ca_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = dvb_ca_read, .read = dvb_ca_read,
.write = dvb_ca_write, .write = dvb_ca_write,
.ioctl = dvb_generic_ioctl, .unlocked_ioctl = dvb_generic_ioctl,
.open = dvb_ca_open, .open = dvb_ca_open,
.release = dvb_generic_release, .release = dvb_generic_release,
.poll = dvb_ca_poll, .poll = dvb_ca_poll,

View file

@ -468,8 +468,7 @@ static int mtd_do_readoob(struct mtd_info *mtd, uint64_t start,
return ret; return ret;
} }
static int mtd_ioctl(struct inode *inode, struct file *file, static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
u_int cmd, u_long arg)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
@ -840,6 +839,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
} /* memory_ioctl */ } /* memory_ioctl */
static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{
int ret;
lock_kernel();
ret = mtd_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
struct mtd_oob_buf32 { struct mtd_oob_buf32 {
@ -854,7 +864,6 @@ struct mtd_oob_buf32 {
static long mtd_compat_ioctl(struct file *file, unsigned int cmd, static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct inode *inode = file->f_path.dentry->d_inode;
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
void __user *argp = compat_ptr(arg); void __user *argp = compat_ptr(arg);
@ -892,7 +901,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
break; break;
} }
default: default:
ret = mtd_ioctl(inode, file, cmd, (unsigned long)argp); ret = mtd_ioctl(file, cmd, (unsigned long)argp);
} }
unlock_kernel(); unlock_kernel();
@ -960,7 +969,7 @@ static const struct file_operations mtd_fops = {
.llseek = mtd_lseek, .llseek = mtd_lseek,
.read = mtd_read, .read = mtd_read,
.write = mtd_write, .write = mtd_write,
.ioctl = mtd_ioctl, .unlocked_ioctl = mtd_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = mtd_compat_ioctl, .compat_ioctl = mtd_compat_ioctl,
#endif #endif

View file

@ -813,8 +813,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
/*====================================================================*/ /*====================================================================*/
static int ds_ioctl(struct inode *inode, struct file *file, static int ds_ioctl(struct file *file, u_int cmd, u_long arg)
u_int cmd, u_long arg)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s;
void __user *uarg = (char __user *)arg; void __user *uarg = (char __user *)arg;
@ -1021,13 +1020,25 @@ free_out:
return err; return err;
} /* ds_ioctl */ } /* ds_ioctl */
static long ds_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = ds_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
/*====================================================================*/ /*====================================================================*/
static const struct file_operations ds_fops = { static const struct file_operations ds_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = ds_open, .open = ds_open,
.release = ds_release, .release = ds_release,
.ioctl = ds_ioctl, .unlocked_ioctl = ds_unlocked_ioctl,
.read = ds_read, .read = ds_read,
.write = ds_write, .write = ds_write,
.poll = ds_poll, .poll = ds_poll,

View file

@ -623,7 +623,7 @@ static ssize_t wdt_read(struct file *file, char __user *buf,
* according to their available features. We only actually usefully support * according to their available features. We only actually usefully support
* querying capabilities and current status. * querying capabilities and current status.
*/ */
static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int wdt_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
int new_margin, rv; int new_margin, rv;
@ -676,6 +676,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
return -ENOTTY; return -ENOTTY;
} }
static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int ret;
lock_kernel();
ret = wdt_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
/** /**
* wdt_open: * wdt_open:
* @inode: inode of device * @inode: inode of device
@ -736,7 +748,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
static const struct file_operations wdt_fops = { static const struct file_operations wdt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = wdt_read, .read = wdt_read,
.ioctl = wdt_ioctl, .unlocked_ioctl = wdt_unlocked_ioctl,
.write = wdt_write, .write = wdt_write,
.open = wdt_open, .open = wdt_open,
.release = wdt_release, .release = wdt_release,

View file

@ -298,9 +298,9 @@ static int opromgetbootargs(void __user *argp, struct openpromio *op, int bufsiz
/* /*
* SunOS and Solaris /dev/openprom ioctl calls. * SunOS and Solaris /dev/openprom ioctl calls.
*/ */
static int openprom_sunos_ioctl(struct inode * inode, struct file * file, static long openprom_sunos_ioctl(struct file * file,
unsigned int cmd, unsigned long arg, unsigned int cmd, unsigned long arg,
struct device_node *dp) struct device_node *dp)
{ {
DATA *data = file->private_data; DATA *data = file->private_data;
struct openpromio *opp = NULL; struct openpromio *opp = NULL;
@ -316,6 +316,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
if (bufsize < 0) if (bufsize < 0)
return bufsize; return bufsize;
lock_kernel();
switch (cmd) { switch (cmd) {
case OPROMGETOPT: case OPROMGETOPT:
case OPROMGETPROP: case OPROMGETPROP:
@ -365,6 +367,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
} }
kfree(opp); kfree(opp);
unlock_kernel();
return error; return error;
} }
@ -547,13 +551,14 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
return 0; return 0;
} }
static int openprom_bsd_ioctl(struct inode * inode, struct file * file, static int openprom_bsd_ioctl(struct file * file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
DATA *data = (DATA *) file->private_data; DATA *data = (DATA *) file->private_data;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int err; int err;
lock_kernel();
switch (cmd) { switch (cmd) {
case OPIOCGET: case OPIOCGET:
err = opiocget(argp, data); err = opiocget(argp, data);
@ -570,10 +575,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
case OPIOCGETOPTNODE: case OPIOCGETOPTNODE:
BUILD_BUG_ON(sizeof(phandle) != sizeof(int)); BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
err = 0;
if (copy_to_user(argp, &options_node->phandle, sizeof(phandle))) if (copy_to_user(argp, &options_node->phandle, sizeof(phandle)))
return -EFAULT; err = -EFAULT;
break;
return 0;
case OPIOCGETNEXT: case OPIOCGETNEXT:
case OPIOCGETCHILD: case OPIOCGETCHILD:
@ -581,9 +586,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
break; break;
default: default:
return -EINVAL; err = -EINVAL;
break;
}; };
unlock_kernel();
return err; return err;
} }
@ -592,8 +598,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
/* /*
* Handoff control to the correct ioctl handler. * Handoff control to the correct ioctl handler.
*/ */
static int openprom_ioctl(struct inode * inode, struct file * file, static long openprom_ioctl(struct file * file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
DATA *data = (DATA *) file->private_data; DATA *data = (DATA *) file->private_data;
@ -602,14 +608,14 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
case OPROMNXTOPT: case OPROMNXTOPT:
if ((file->f_mode & FMODE_READ) == 0) if ((file->f_mode & FMODE_READ) == 0)
return -EPERM; return -EPERM;
return openprom_sunos_ioctl(inode, file, cmd, arg, return openprom_sunos_ioctl(file, cmd, arg,
options_node); options_node);
case OPROMSETOPT: case OPROMSETOPT:
case OPROMSETOPT2: case OPROMSETOPT2:
if ((file->f_mode & FMODE_WRITE) == 0) if ((file->f_mode & FMODE_WRITE) == 0)
return -EPERM; return -EPERM;
return openprom_sunos_ioctl(inode, file, cmd, arg, return openprom_sunos_ioctl(file, cmd, arg,
options_node); options_node);
case OPROMNEXT: case OPROMNEXT:
@ -618,7 +624,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
case OPROMNXTPROP: case OPROMNXTPROP:
if ((file->f_mode & FMODE_READ) == 0) if ((file->f_mode & FMODE_READ) == 0)
return -EPERM; return -EPERM;
return openprom_sunos_ioctl(inode, file, cmd, arg, return openprom_sunos_ioctl(file, cmd, arg,
data->current_node); data->current_node);
case OPROMU2P: case OPROMU2P:
@ -630,7 +636,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
case OPROMPATH2NODE: case OPROMPATH2NODE:
if ((file->f_mode & FMODE_READ) == 0) if ((file->f_mode & FMODE_READ) == 0)
return -EPERM; return -EPERM;
return openprom_sunos_ioctl(inode, file, cmd, arg, NULL); return openprom_sunos_ioctl(file, cmd, arg, NULL);
case OPIOCGET: case OPIOCGET:
case OPIOCNEXTPROP: case OPIOCNEXTPROP:
@ -639,12 +645,12 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
case OPIOCGETCHILD: case OPIOCGETCHILD:
if ((file->f_mode & FMODE_READ) == 0) if ((file->f_mode & FMODE_READ) == 0)
return -EBADF; return -EBADF;
return openprom_bsd_ioctl(inode,file,cmd,arg); return openprom_bsd_ioctl(file,cmd,arg);
case OPIOCSET: case OPIOCSET:
if ((file->f_mode & FMODE_WRITE) == 0) if ((file->f_mode & FMODE_WRITE) == 0)
return -EBADF; return -EBADF;
return openprom_bsd_ioctl(inode,file,cmd,arg); return openprom_bsd_ioctl(file,cmd,arg);
default: default:
return -EINVAL; return -EINVAL;
@ -676,7 +682,7 @@ static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
case OPROMSETCUR: case OPROMSETCUR:
case OPROMPCI2NODE: case OPROMPCI2NODE:
case OPROMPATH2NODE: case OPROMPATH2NODE:
rval = openprom_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); rval = openprom_ioctl(file, cmd, arg);
break; break;
} }
@ -709,7 +715,7 @@ static int openprom_release(struct inode * inode, struct file * file)
static const struct file_operations openprom_fops = { static const struct file_operations openprom_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.ioctl = openprom_ioctl, .unlocked_ioctl = openprom_ioctl,
.compat_ioctl = openprom_compat_ioctl, .compat_ioctl = openprom_compat_ioctl,
.open = openprom_open, .open = openprom_open,
.release = openprom_release, .release = openprom_release,

View file

@ -125,7 +125,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H
static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id); static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id);
static char *twa_aen_severity_lookup(unsigned char severity_code); static char *twa_aen_severity_lookup(unsigned char severity_code);
static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id); static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id);
static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
static int twa_chrdev_open(struct inode *inode, struct file *file); static int twa_chrdev_open(struct inode *inode, struct file *file);
static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host); static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host);
static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id); static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id);
@ -220,7 +220,7 @@ static struct device_attribute *twa_host_attrs[] = {
/* File operations struct for character device */ /* File operations struct for character device */
static const struct file_operations twa_fops = { static const struct file_operations twa_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = twa_chrdev_ioctl, .unlocked_ioctl = twa_chrdev_ioctl,
.open = twa_chrdev_open, .open = twa_chrdev_open,
.release = NULL .release = NULL
}; };
@ -637,8 +637,9 @@ out:
} /* End twa_check_srl() */ } /* End twa_check_srl() */
/* This function handles ioctl for the character device */ /* This function handles ioctl for the character device */
static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct inode *inode = file->f_path.dentry->d_inode;
long timeout; long timeout;
unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0;
dma_addr_t dma_handle; dma_addr_t dma_handle;
@ -657,6 +658,8 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
int retval = TW_IOCTL_ERROR_OS_EFAULT; int retval = TW_IOCTL_ERROR_OS_EFAULT;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
lock_kernel();
/* Only let one of these through at a time */ /* Only let one of these through at a time */
if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
retval = TW_IOCTL_ERROR_OS_EINTR; retval = TW_IOCTL_ERROR_OS_EINTR;
@ -876,6 +879,7 @@ out3:
out2: out2:
mutex_unlock(&tw_dev->ioctl_lock); mutex_unlock(&tw_dev->ioctl_lock);
out: out:
unlock_kernel();
return retval; return retval;
} /* End twa_chrdev_ioctl() */ } /* End twa_chrdev_ioctl() */

View file

@ -750,19 +750,22 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
/* This function handles ioctl for the character device /* This function handles ioctl for the character device
This interface is used by smartmontools open source software */ This interface is used by smartmontools open source software */
static int twl_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
long timeout; long timeout;
unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0;
dma_addr_t dma_handle; dma_addr_t dma_handle;
int request_id = 0; int request_id = 0;
TW_Ioctl_Driver_Command driver_command; TW_Ioctl_Driver_Command driver_command;
struct inode *inode = file->f_dentry->d_inode;
TW_Ioctl_Buf_Apache *tw_ioctl; TW_Ioctl_Buf_Apache *tw_ioctl;
TW_Command_Full *full_command_packet; TW_Command_Full *full_command_packet;
TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)];
int retval = -EFAULT; int retval = -EFAULT;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
lock_kernel();
/* Only let one of these through at a time */ /* Only let one of these through at a time */
if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
retval = -EINTR; retval = -EINTR;
@ -858,6 +861,7 @@ out3:
out2: out2:
mutex_unlock(&tw_dev->ioctl_lock); mutex_unlock(&tw_dev->ioctl_lock);
out: out:
unlock_kernel();
return retval; return retval;
} /* End twl_chrdev_ioctl() */ } /* End twl_chrdev_ioctl() */
@ -884,7 +888,7 @@ out:
/* File operations struct for character device */ /* File operations struct for character device */
static const struct file_operations twl_fops = { static const struct file_operations twl_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = twl_chrdev_ioctl, .unlocked_ioctl = twl_chrdev_ioctl,
.open = twl_chrdev_open, .open = twl_chrdev_open,
.release = NULL .release = NULL
}; };

View file

@ -881,7 +881,7 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)
} /* End tw_allocate_memory() */ } /* End tw_allocate_memory() */
/* This function handles ioctl for the character device */ /* This function handles ioctl for the character device */
static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
int request_id; int request_id;
dma_addr_t dma_handle; dma_addr_t dma_handle;
@ -889,6 +889,7 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
unsigned long flags; unsigned long flags;
unsigned int data_buffer_length = 0; unsigned int data_buffer_length = 0;
unsigned long data_buffer_length_adjusted = 0; unsigned long data_buffer_length_adjusted = 0;
struct inode *inode = file->f_dentry->d_inode;
unsigned long *cpu_addr; unsigned long *cpu_addr;
long timeout; long timeout;
TW_New_Ioctl *tw_ioctl; TW_New_Ioctl *tw_ioctl;
@ -899,9 +900,12 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
lock_kernel();
/* Only let one of these through at a time */ /* Only let one of these through at a time */
if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
unlock_kernel();
return -EINTR; return -EINTR;
}
/* First copy down the buffer length */ /* First copy down the buffer length */
if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int))) if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int)))
@ -1030,6 +1034,7 @@ out2:
dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle);
out: out:
mutex_unlock(&tw_dev->ioctl_lock); mutex_unlock(&tw_dev->ioctl_lock);
unlock_kernel();
return retval; return retval;
} /* End tw_chrdev_ioctl() */ } /* End tw_chrdev_ioctl() */
@ -1052,7 +1057,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file)
/* File operations struct for character device */ /* File operations struct for character device */
static const struct file_operations tw_fops = { static const struct file_operations tw_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = tw_chrdev_ioctl, .unlocked_ioctl = tw_chrdev_ioctl,
.open = tw_chrdev_open, .open = tw_chrdev_open,
.release = NULL .release = NULL
}; };

View file

@ -705,12 +705,17 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
* Bugs: Needs to handle hot plugging * Bugs: Needs to handle hot plugging
*/ */
static int aac_cfg_ioctl(struct inode *inode, struct file *file, static long aac_cfg_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int ret;
if (!capable(CAP_SYS_RAWIO)) if (!capable(CAP_SYS_RAWIO))
return -EPERM; return -EPERM;
return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); lock_kernel();
ret = aac_do_ioctl(file->private_data, cmd, (void __user *)arg);
unlock_kernel();
return ret;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
@ -1029,7 +1034,7 @@ ssize_t aac_get_serial_number(struct device *device, char *buf)
static const struct file_operations aac_cfg_fops = { static const struct file_operations aac_cfg_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = aac_cfg_ioctl, .unlocked_ioctl = aac_cfg_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = aac_compat_cfg_ioctl, .compat_ioctl = aac_compat_cfg_ioctl,
#endif #endif

View file

@ -114,12 +114,13 @@ static int hba_count = 0;
static struct class *adpt_sysfs_class; static struct class *adpt_sysfs_class;
static long adpt_unlocked_ioctl(struct file *, unsigned int, unsigned long);
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long);
#endif #endif
static const struct file_operations adpt_fops = { static const struct file_operations adpt_fops = {
.ioctl = adpt_ioctl, .unlocked_ioctl = adpt_unlocked_ioctl,
.open = adpt_open, .open = adpt_open,
.release = adpt_close, .release = adpt_close,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
@ -2069,8 +2070,7 @@ static int adpt_system_info(void __user *buffer)
return 0; return 0;
} }
static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
ulong arg)
{ {
int minor; int minor;
int error = 0; int error = 0;
@ -2153,6 +2153,20 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
return error; return error;
} }
static long adpt_unlocked_ioctl(struct file *file, uint cmd, ulong arg)
{
struct inode *inode;
long ret;
inode = file->f_dentry->d_inode;
lock_kernel();
ret = adpt_ioctl(inode, file, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long compat_adpt_ioctl(struct file *file, static long compat_adpt_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)

View file

@ -180,8 +180,8 @@ static const char *gdth_ctr_name(gdth_ha_str *ha);
static int gdth_open(struct inode *inode, struct file *filep); static int gdth_open(struct inode *inode, struct file *filep);
static int gdth_close(struct inode *inode, struct file *filep); static int gdth_close(struct inode *inode, struct file *filep);
static int gdth_ioctl(struct inode *inode, struct file *filep, static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd,
unsigned int cmd, unsigned long arg); unsigned long arg);
static void gdth_flush(gdth_ha_str *ha); static void gdth_flush(gdth_ha_str *ha);
static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
@ -369,7 +369,7 @@ MODULE_LICENSE("GPL");
/* ioctl interface */ /* ioctl interface */
static const struct file_operations gdth_fops = { static const struct file_operations gdth_fops = {
.ioctl = gdth_ioctl, .unlocked_ioctl = gdth_unlocked_ioctl,
.open = gdth_open, .open = gdth_open,
.release = gdth_close, .release = gdth_close,
}; };
@ -4462,8 +4462,7 @@ free_fail:
return rc; return rc;
} }
static int gdth_ioctl(struct inode *inode, struct file *filep, static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
gdth_ha_str *ha; gdth_ha_str *ha;
Scsi_Cmnd *scp; Scsi_Cmnd *scp;
@ -4611,6 +4610,17 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
return 0; return 0;
} }
static long gdth_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int ret;
lock_kernel();
ret = gdth_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
/* flush routine */ /* flush routine */
static void gdth_flush(gdth_ha_str *ha) static void gdth_flush(gdth_ha_str *ha)

View file

@ -91,12 +91,15 @@ static struct proc_dir_entry *mega_proc_dir_entry;
/* For controller re-ordering */ /* For controller re-ordering */
static struct mega_hbas mega_hbas[MAX_CONTROLLERS]; static struct mega_hbas mega_hbas[MAX_CONTROLLERS];
static long
megadev_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
/* /*
* The File Operations structure for the serial/ioctl interface of the driver * The File Operations structure for the serial/ioctl interface of the driver
*/ */
static const struct file_operations megadev_fops = { static const struct file_operations megadev_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = megadev_ioctl, .unlocked_ioctl = megadev_unlocked_ioctl,
.open = megadev_open, .open = megadev_open,
}; };
@ -3302,8 +3305,7 @@ megadev_open (struct inode *inode, struct file *filep)
* controller. * controller.
*/ */
static int static int
megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
adapter_t *adapter; adapter_t *adapter;
nitioctl_t uioc; nitioctl_t uioc;
@ -3694,6 +3696,18 @@ freemem_and_return:
return 0; return 0;
} }
static long
megadev_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
int ret;
lock_kernel();
ret = megadev_ioctl(filep, cmd, arg);
unlock_kernel();
return ret;
}
/** /**
* mega_m_to_n() * mega_m_to_n()
* @arg - user address * @arg - user address

View file

@ -1013,8 +1013,7 @@ static void mega_8_to_40ld (mraid_inquiry *inquiry,
mega_inquiry3 *enquiry3, mega_product_info *); mega_inquiry3 *enquiry3, mega_product_info *);
static int megadev_open (struct inode *, struct file *); static int megadev_open (struct inode *, struct file *);
static int megadev_ioctl (struct inode *, struct file *, unsigned int, static int megadev_ioctl (struct file *, unsigned int, unsigned long);
unsigned long);
static int mega_m_to_n(void __user *, nitioctl_t *); static int mega_m_to_n(void __user *, nitioctl_t *);
static int mega_n_to_m(void __user *, megacmd_t *); static int mega_n_to_m(void __user *, megacmd_t *);

View file

@ -22,7 +22,7 @@
// Entry points for char node driver // Entry points for char node driver
static int mraid_mm_open(struct inode *, struct file *); static int mraid_mm_open(struct inode *, struct file *);
static int mraid_mm_ioctl(struct inode *, struct file *, uint, unsigned long); static long mraid_mm_unlocked_ioctl(struct file *, uint, unsigned long);
// routines to convert to and from the old the format // routines to convert to and from the old the format
@ -70,7 +70,7 @@ static wait_queue_head_t wait_q;
static const struct file_operations lsi_fops = { static const struct file_operations lsi_fops = {
.open = mraid_mm_open, .open = mraid_mm_open,
.ioctl = mraid_mm_ioctl, .unlocked_ioctl = mraid_mm_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = mraid_mm_compat_ioctl, .compat_ioctl = mraid_mm_compat_ioctl,
#endif #endif
@ -110,8 +110,7 @@ mraid_mm_open(struct inode *inode, struct file *filep)
* @arg : user ioctl packet * @arg : user ioctl packet
*/ */
static int static int
mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, mraid_mm_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
uioc_t *kioc; uioc_t *kioc;
char signature[EXT_IOCTL_SIGN_SZ] = {0}; char signature[EXT_IOCTL_SIGN_SZ] = {0};
@ -218,6 +217,19 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
return rval; return rval;
} }
static long
mraid_mm_unlocked_ioctl(struct file *filep, unsigned int cmd,
unsigned long arg)
{
int err;
/* inconsistant: mraid_mm_compat_ioctl doesn't take the BKL */
lock_kernel();
err = mraid_mm_ioctl(filep, cmd, arg);
unlock_kernel();
return err;
}
/** /**
* mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet
@ -1225,7 +1237,7 @@ mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd,
{ {
int err; int err;
err = mraid_mm_ioctl(NULL, filep, cmd, arg); err = mraid_mm_ioctl(filep, cmd, arg);
return err; return err;
} }

View file

@ -4932,7 +4932,7 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
/* The ioctl command */ /* The ioctl command */
static int osst_ioctl(struct inode * inode,struct file * file, static long osst_ioctl(struct file * file,
unsigned int cmd_in, unsigned long arg) unsigned int cmd_in, unsigned long arg)
{ {
int i, cmd_nr, cmd_type, blk, retval = 0; int i, cmd_nr, cmd_type, blk, retval = 0;
@ -4943,8 +4943,11 @@ static int osst_ioctl(struct inode * inode,struct file * file,
char * name = tape_name(STp); char * name = tape_name(STp);
void __user * p = (void __user *)arg; void __user * p = (void __user *)arg;
if (mutex_lock_interruptible(&STp->lock)) lock_kernel();
if (mutex_lock_interruptible(&STp->lock)) {
unlock_kernel();
return -ERESTARTSYS; return -ERESTARTSYS;
}
#if DEBUG #if DEBUG
if (debugging && !STp->in_use) { if (debugging && !STp->in_use) {
@ -5256,12 +5259,15 @@ static int osst_ioctl(struct inode * inode,struct file * file,
mutex_unlock(&STp->lock); mutex_unlock(&STp->lock);
return scsi_ioctl(STp->device, cmd_in, p); retval = scsi_ioctl(STp->device, cmd_in, p);
unlock_kernel();
return retval;
out: out:
if (SRpnt) osst_release_request(SRpnt); if (SRpnt) osst_release_request(SRpnt);
mutex_unlock(&STp->lock); mutex_unlock(&STp->lock);
unlock_kernel();
return retval; return retval;
} }
@ -5613,7 +5619,7 @@ static const struct file_operations osst_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = osst_read, .read = osst_read,
.write = osst_write, .write = osst_write,
.ioctl = osst_ioctl, .unlocked_ioctl = osst_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = osst_compat_ioctl, .compat_ioctl = osst_compat_ioctl,
#endif #endif

View file

@ -758,8 +758,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
} }
static int static int
sg_ioctl(struct inode *inode, struct file *filp, sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
unsigned int cmd_in, unsigned long arg)
{ {
void __user *p = (void __user *)arg; void __user *p = (void __user *)arg;
int __user *ip = p; int __user *ip = p;
@ -1078,6 +1077,18 @@ sg_ioctl(struct inode *inode, struct file *filp,
} }
} }
static long
sg_unlocked_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
{
int ret;
lock_kernel();
ret = sg_ioctl(filp, cmd_in, arg);
unlock_kernel();
return ret;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
{ {
@ -1322,7 +1333,7 @@ static const struct file_operations sg_fops = {
.read = sg_read, .read = sg_read,
.write = sg_write, .write = sg_write,
.poll = sg_poll, .poll = sg_poll,
.ioctl = sg_ioctl, .unlocked_ioctl = sg_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = sg_compat_ioctl, .compat_ioctl = sg_compat_ioctl,
#endif #endif

View file

@ -954,8 +954,7 @@ static int mon_bin_queued(struct mon_reader_bin *rp)
/* /*
*/ */
static int mon_bin_ioctl(struct inode *inode, struct file *file, static int mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct mon_reader_bin *rp = file->private_data; struct mon_reader_bin *rp = file->private_data;
// struct mon_bus* mbus = rp->r.m_bus; // struct mon_bus* mbus = rp->r.m_bus;
@ -1095,6 +1094,19 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
} }
static long mon_bin_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int ret;
lock_kernel();
ret = mon_bin_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long mon_bin_compat_ioctl(struct file *file, static long mon_bin_compat_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
@ -1148,14 +1160,13 @@ static long mon_bin_compat_ioctl(struct file *file,
return 0; return 0;
case MON_IOCG_STATS: case MON_IOCG_STATS:
return mon_bin_ioctl(NULL, file, cmd, return mon_bin_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
(unsigned long) compat_ptr(arg));
case MON_IOCQ_URB_LEN: case MON_IOCQ_URB_LEN:
case MON_IOCQ_RING_SIZE: case MON_IOCQ_RING_SIZE:
case MON_IOCT_RING_SIZE: case MON_IOCT_RING_SIZE:
case MON_IOCH_MFLUSH: case MON_IOCH_MFLUSH:
return mon_bin_ioctl(NULL, file, cmd, arg); return mon_bin_ioctl(file, cmd, arg);
default: default:
; ;
@ -1239,7 +1250,7 @@ static const struct file_operations mon_fops_binary = {
.read = mon_bin_read, .read = mon_bin_read,
/* .write = mon_text_write, */ /* .write = mon_text_write, */
.poll = mon_bin_poll, .poll = mon_bin_poll,
.ioctl = mon_bin_ioctl, .unlocked_ioctl = mon_bin_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = mon_bin_compat_ioctl, .compat_ioctl = mon_bin_compat_ioctl,
#endif #endif

View file

@ -11,6 +11,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "usb_mon.h" #include "usb_mon.h"
@ -63,6 +64,6 @@ const struct file_operations mon_fops_stat = {
.read = mon_stat_read, .read = mon_stat_read,
/* .write = mon_stat_write, */ /* .write = mon_stat_write, */
/* .poll = mon_stat_poll, */ /* .poll = mon_stat_poll, */
/* .ioctl = mon_stat_ioctl, */ /* .unlocked_ioctl = mon_stat_ioctl, */
.release = mon_stat_release, .release = mon_stat_release,
}; };

View file

@ -18,13 +18,14 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/param.h> #include <linux/param.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/smp_lock.h>
#include "autofs_i.h" #include "autofs_i.h"
static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
static int autofs4_dir_unlink(struct inode *,struct dentry *); static int autofs4_dir_unlink(struct inode *,struct dentry *);
static int autofs4_dir_rmdir(struct inode *,struct dentry *); static int autofs4_dir_rmdir(struct inode *,struct dentry *);
static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
static int autofs4_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long); static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
static int autofs4_dir_open(struct inode *inode, struct file *file); static int autofs4_dir_open(struct inode *inode, struct file *file);
static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
static void *autofs4_follow_link(struct dentry *, struct nameidata *); static void *autofs4_follow_link(struct dentry *, struct nameidata *);
@ -38,7 +39,7 @@ const struct file_operations autofs4_root_operations = {
.read = generic_read_dir, .read = generic_read_dir,
.readdir = dcache_readdir, .readdir = dcache_readdir,
.llseek = dcache_dir_lseek, .llseek = dcache_dir_lseek,
.ioctl = autofs4_root_ioctl, .unlocked_ioctl = autofs4_root_ioctl,
}; };
const struct file_operations autofs4_dir_operations = { const struct file_operations autofs4_dir_operations = {
@ -902,8 +903,8 @@ int is_autofs4_dentry(struct dentry *dentry)
* ioctl()'s on the root directory is the chief method for the daemon to * ioctl()'s on the root directory is the chief method for the daemon to
* generate kernel reactions * generate kernel reactions
*/ */
static int autofs4_root_ioctl(struct inode *inode, struct file *filp, static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb); struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
void __user *p = (void __user *)arg; void __user *p = (void __user *)arg;
@ -947,3 +948,16 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
return -ENOSYS; return -ENOSYS;
} }
} }
static long autofs4_root_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg)
{
long ret;
struct inode *inode = filp->f_dentry->d_inode;
lock_kernel();
ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
unlock_kernel();
return ret;
}

View file

@ -1,6 +1,6 @@
/* /*
* Pioctl operations for Coda. * Pioctl operations for Coda.
* Original version: (C) 1996 Peter Braam * Original version: (C) 1996 Peter Braam
* Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University
* *
* Carnegie Mellon encourages users of this code to contribute improvements * Carnegie Mellon encourages users of this code to contribute improvements
@ -23,21 +23,22 @@
#include <linux/coda_fs_i.h> #include <linux/coda_fs_i.h>
#include <linux/coda_psdev.h> #include <linux/coda_psdev.h>
#include <linux/smp_lock.h>
/* pioctl ops */ /* pioctl ops */
static int coda_ioctl_permission(struct inode *inode, int mask); static int coda_ioctl_permission(struct inode *inode, int mask);
static int coda_pioctl(struct inode * inode, struct file * filp, static long coda_pioctl(struct file *filp, unsigned int cmd,
unsigned int cmd, unsigned long user_data); unsigned long user_data);
/* exported from this file */ /* exported from this file */
const struct inode_operations coda_ioctl_inode_operations = const struct inode_operations coda_ioctl_inode_operations = {
{
.permission = coda_ioctl_permission, .permission = coda_ioctl_permission,
.setattr = coda_setattr, .setattr = coda_setattr,
}; };
const struct file_operations coda_ioctl_operations = { const struct file_operations coda_ioctl_operations = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = coda_pioctl, .unlocked_ioctl = coda_pioctl,
}; };
/* the coda pioctl inode ops */ /* the coda pioctl inode ops */
@ -46,48 +47,53 @@ static int coda_ioctl_permission(struct inode *inode, int mask)
return (mask & MAY_EXEC) ? -EACCES : 0; return (mask & MAY_EXEC) ? -EACCES : 0;
} }
static int coda_pioctl(struct inode * inode, struct file * filp, static long coda_pioctl(struct file *filp, unsigned int cmd,
unsigned int cmd, unsigned long user_data) unsigned long user_data)
{ {
struct path path; struct path path;
int error; int error;
struct PioctlData data; struct PioctlData data;
struct inode *target_inode = NULL; struct inode *inode = filp->f_dentry->d_inode;
struct coda_inode_info *cnp; struct inode *target_inode = NULL;
struct coda_inode_info *cnp;
/* get the Pioctl data arguments from user space */ lock_kernel();
if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) {
return -EINVAL; /* get the Pioctl data arguments from user space */
if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) {
error = -EINVAL;
goto out;
} }
/* /*
* Look up the pathname. Note that the pathname is in * Look up the pathname. Note that the pathname is in
* user memory, and namei takes care of this * user memory, and namei takes care of this
*/ */
if (data.follow) { if (data.follow)
error = user_path(data.path, &path); error = user_path(data.path, &path);
} else { else
error = user_lpath(data.path, &path); error = user_lpath(data.path, &path);
}
if (error)
if ( error ) { goto out;
return error; else
} else {
target_inode = path.dentry->d_inode; target_inode = path.dentry->d_inode;
}
/* return if it is not a Coda inode */ /* return if it is not a Coda inode */
if ( target_inode->i_sb != inode->i_sb ) { if (target_inode->i_sb != inode->i_sb) {
path_put(&path); path_put(&path);
return -EINVAL; error = -EINVAL;
goto out;
} }
/* now proceed to make the upcall */ /* now proceed to make the upcall */
cnp = ITOC(target_inode); cnp = ITOC(target_inode);
error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
path_put(&path); path_put(&path);
return error;
}
out:
unlock_kernel();
return error;
}

View file

@ -73,8 +73,7 @@ static unsigned int coda_psdev_poll(struct file *file, poll_table * wait)
return mask; return mask;
} }
static int coda_psdev_ioctl(struct inode * inode, struct file * filp, static long coda_psdev_ioctl(struct file * filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
unsigned int data; unsigned int data;
@ -344,7 +343,7 @@ static const struct file_operations coda_psdev_fops = {
.read = coda_psdev_read, .read = coda_psdev_read,
.write = coda_psdev_write, .write = coda_psdev_write,
.poll = coda_psdev_poll, .poll = coda_psdev_poll,
.ioctl = coda_psdev_ioctl, .unlocked_ioctl = coda_psdev_ioctl,
.open = coda_psdev_open, .open = coda_psdev_open,
.release = coda_psdev_release, .release = coda_psdev_release,
}; };

View file

@ -494,7 +494,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
const struct file_operations hfsplus_dir_operations = { const struct file_operations hfsplus_dir_operations = {
.read = generic_read_dir, .read = generic_read_dir,
.readdir = hfsplus_readdir, .readdir = hfsplus_readdir,
.ioctl = hfsplus_ioctl, .unlocked_ioctl = hfsplus_ioctl,
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.release = hfsplus_dir_release, .release = hfsplus_dir_release,
}; };

View file

@ -337,8 +337,7 @@ struct inode *hfsplus_new_inode(struct super_block *, int);
void hfsplus_delete_inode(struct inode *); void hfsplus_delete_inode(struct inode *);
/* ioctl.c */ /* ioctl.c */
int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
unsigned long arg);
int hfsplus_setxattr(struct dentry *dentry, const char *name, int hfsplus_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags); const void *value, size_t size, int flags);
ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,

View file

@ -285,7 +285,7 @@ static const struct file_operations hfsplus_file_operations = {
.fsync = file_fsync, .fsync = file_fsync,
.open = hfsplus_file_open, .open = hfsplus_file_open,
.release = hfsplus_file_release, .release = hfsplus_file_release,
.ioctl = hfsplus_ioctl, .unlocked_ioctl = hfsplus_ioctl,
}; };
struct inode *hfsplus_new_inode(struct super_block *sb, int mode) struct inode *hfsplus_new_inode(struct super_block *sb, int mode)

View file

@ -17,14 +17,16 @@
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "hfsplus_fs.h" #include "hfsplus_fs.h"
int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
struct inode *inode = filp->f_path.dentry->d_inode;
unsigned int flags; unsigned int flags;
lock_kernel();
switch (cmd) { switch (cmd) {
case HFSPLUS_IOC_EXT2_GETFLAGS: case HFSPLUS_IOC_EXT2_GETFLAGS:
flags = 0; flags = 0;
@ -38,8 +40,10 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
case HFSPLUS_IOC_EXT2_SETFLAGS: { case HFSPLUS_IOC_EXT2_SETFLAGS: {
int err = 0; int err = 0;
err = mnt_want_write(filp->f_path.mnt); err = mnt_want_write(filp->f_path.mnt);
if (err) if (err) {
unlock_kernel();
return err; return err;
}
if (!is_owner_or_cap(inode)) { if (!is_owner_or_cap(inode)) {
err = -EACCES; err = -EACCES;
@ -85,9 +89,11 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
mark_inode_dirty(inode); mark_inode_dirty(inode);
setflags_out: setflags_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write(filp->f_path.mnt);
unlock_kernel();
return err; return err;
} }
default: default:
unlock_kernel();
return -ENOTTY; return -ENOTTY;
} }
} }

View file

@ -51,7 +51,7 @@ const struct file_operations ncp_dir_operations =
{ {
.read = generic_read_dir, .read = generic_read_dir,
.readdir = ncp_readdir, .readdir = ncp_readdir,
.ioctl = ncp_ioctl, .unlocked_ioctl = ncp_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = ncp_compat_ioctl, .compat_ioctl = ncp_compat_ioctl,
#endif #endif

View file

@ -295,7 +295,7 @@ const struct file_operations ncp_file_operations =
.llseek = ncp_remote_llseek, .llseek = ncp_remote_llseek,
.read = ncp_file_read, .read = ncp_file_read,
.write = ncp_file_write, .write = ncp_file_write,
.ioctl = ncp_ioctl, .unlocked_ioctl = ncp_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = ncp_compat_ioctl, .compat_ioctl = ncp_compat_ioctl,
#endif #endif

View file

@ -20,6 +20,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/ncp_fs.h> #include <linux/ncp_fs.h>
@ -261,9 +262,9 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
} }
#endif /* CONFIG_NCPFS_NLS */ #endif /* CONFIG_NCPFS_NLS */
static int __ncp_ioctl(struct inode *inode, struct file *filp, static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct inode *inode = filp->f_dentry->d_inode;
struct ncp_server *server = NCP_SERVER(inode); struct ncp_server *server = NCP_SERVER(inode);
int result; int result;
struct ncp_ioctl_request request; struct ncp_ioctl_request request;
@ -841,11 +842,11 @@ static int ncp_ioctl_need_write(unsigned int cmd)
} }
} }
int ncp_ioctl(struct inode *inode, struct file *filp, long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
int ret; long ret;
lock_kernel();
if (ncp_ioctl_need_write(cmd)) { if (ncp_ioctl_need_write(cmd)) {
/* /*
* inside the ioctl(), any failures which * inside the ioctl(), any failures which
@ -853,24 +854,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
* -EACCESS, so it seems consistent to keep * -EACCESS, so it seems consistent to keep
* that here. * that here.
*/ */
if (mnt_want_write(filp->f_path.mnt)) if (mnt_want_write(filp->f_path.mnt)) {
return -EACCES; ret = -EACCES;
goto out;
}
} }
ret = __ncp_ioctl(inode, filp, cmd, arg); ret = __ncp_ioctl(filp, cmd, arg);
if (ncp_ioctl_need_write(cmd)) if (ncp_ioctl_need_write(cmd))
mnt_drop_write(filp->f_path.mnt); mnt_drop_write(filp->f_path.mnt);
out:
unlock_kernel();
return ret; return ret;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct inode *inode = file->f_path.dentry->d_inode; long ret;
int ret;
lock_kernel(); lock_kernel();
arg = (unsigned long) compat_ptr(arg); arg = (unsigned long) compat_ptr(arg);
ret = ncp_ioctl(inode, file, cmd, arg); ret = ncp_ioctl(file, cmd, arg);
unlock_kernel(); unlock_kernel();
return ret; return ret;
} }

View file

@ -39,7 +39,7 @@ const struct file_operations smb_dir_operations =
{ {
.read = generic_read_dir, .read = generic_read_dir,
.readdir = smb_readdir, .readdir = smb_readdir,
.ioctl = smb_ioctl, .unlocked_ioctl = smb_ioctl,
.open = smb_dir_open, .open = smb_dir_open,
}; };

View file

@ -437,7 +437,7 @@ const struct file_operations smb_file_operations =
.aio_read = smb_file_aio_read, .aio_read = smb_file_aio_read,
.write = do_sync_write, .write = do_sync_write,
.aio_write = smb_file_aio_write, .aio_write = smb_file_aio_write,
.ioctl = smb_ioctl, .unlocked_ioctl = smb_ioctl,
.mmap = smb_file_mmap, .mmap = smb_file_mmap,
.open = smb_file_open, .open = smb_file_open,
.release = smb_file_release, .release = smb_file_release,

View file

@ -13,6 +13,7 @@
#include <linux/time.h> #include <linux/time.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/smp_lock.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/smb_fs.h> #include <linux/smb_fs.h>
@ -22,14 +23,14 @@
#include "proto.h" #include "proto.h"
int long
smb_ioctl(struct inode *inode, struct file *filp, smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct smb_sb_info *server = server_from_inode(inode); struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);
struct smb_conn_opt opt; struct smb_conn_opt opt;
int result = -EINVAL; int result = -EINVAL;
lock_kernel();
switch (cmd) { switch (cmd) {
uid16_t uid16; uid16_t uid16;
uid_t uid32; uid_t uid32;
@ -62,6 +63,7 @@ smb_ioctl(struct inode *inode, struct file *filp,
default: default:
break; break;
} }
unlock_kernel();
return result; return result;
} }

View file

@ -67,7 +67,7 @@ extern const struct address_space_operations smb_file_aops;
extern const struct file_operations smb_file_operations; extern const struct file_operations smb_file_operations;
extern const struct inode_operations smb_file_inode_operations; extern const struct inode_operations smb_file_inode_operations;
/* ioctl.c */ /* ioctl.c */
extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern long smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
/* smbiod.c */ /* smbiod.c */
extern void smbiod_wake_up(void); extern void smbiod_wake_up(void);
extern int smbiod_register_server(struct smb_sb_info *server); extern int smbiod_register_server(struct smb_sb_info *server);

View file

@ -210,7 +210,7 @@ int ncp_date_dos2unix(__le16 time, __le16 date);
void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
/* linux/fs/ncpfs/ioctl.c */ /* linux/fs/ncpfs/ioctl.c */
int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long); long ncp_ioctl(struct file *, unsigned int, unsigned long);
long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
/* linux/fs/ncpfs/sock.c */ /* linux/fs/ncpfs/sock.c */

View file

@ -34,6 +34,7 @@
#include <linux/sunrpc/cache.h> #include <linux/sunrpc/cache.h>
#include <linux/sunrpc/stats.h> #include <linux/sunrpc/stats.h>
#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/smp_lock.h>
#define RPCDBG_FACILITY RPCDBG_CACHE #define RPCDBG_FACILITY RPCDBG_CACHE
@ -1545,12 +1546,18 @@ static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait)
return cache_poll(filp, wait, cd); return cache_poll(filp, wait, cd);
} }
static int cache_ioctl_pipefs(struct inode *inode, struct file *filp, static long cache_ioctl_pipefs(struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct inode *inode = filp->f_dentry->d_inode;
struct cache_detail *cd = RPC_I(inode)->private; struct cache_detail *cd = RPC_I(inode)->private;
long ret;
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_pipefs(struct inode *inode, struct file *filp) static int cache_open_pipefs(struct inode *inode, struct file *filp)
@ -1573,7 +1580,7 @@ const struct file_operations cache_file_operations_pipefs = {
.read = cache_read_pipefs, .read = cache_read_pipefs,
.write = cache_write_pipefs, .write = cache_write_pipefs,
.poll = cache_poll_pipefs, .poll = cache_poll_pipefs,
.ioctl = cache_ioctl_pipefs, /* for FIONREAD */ .unlocked_ioctl = cache_ioctl_pipefs, /* for FIONREAD */
.open = cache_open_pipefs, .open = cache_open_pipefs,
.release = cache_release_pipefs, .release = cache_release_pipefs,
}; };

View file

@ -27,6 +27,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/sunrpc/cache.h> #include <linux/sunrpc/cache.h>
#include <linux/smp_lock.h>
static struct vfsmount *rpc_mount __read_mostly; static struct vfsmount *rpc_mount __read_mostly;
static int rpc_mount_count; static int rpc_mount_count;
@ -309,8 +310,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
} }
static int static int
rpc_pipe_ioctl(struct inode *ino, struct file *filp, rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode);
int len; int len;
@ -331,13 +331,25 @@ rpc_pipe_ioctl(struct inode *ino, struct file *filp,
} }
} }
static long
rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg);
unlock_kernel();
return ret;
}
static const struct file_operations rpc_pipe_fops = { static const struct file_operations rpc_pipe_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.read = rpc_pipe_read, .read = rpc_pipe_read,
.write = rpc_pipe_write, .write = rpc_pipe_write,
.poll = rpc_pipe_poll, .poll = rpc_pipe_poll,
.ioctl = rpc_pipe_ioctl, .unlocked_ioctl = rpc_pipe_ioctl,
.open = rpc_pipe_open, .open = rpc_pipe_open,
.release = rpc_pipe_release, .release = rpc_pipe_release,
}; };