Messages in this thread Patch in this message | | | From | stoyboyker@gmail ... | Subject | [PATCH 10/13] [drivers/char] changed ioctls to unlocked | Date | Tue, 24 Mar 2009 16:12:45 -0500 |
| |
From: Stoyan Gaydarov <stoyboyker@gmail.com>
Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com> --- drivers/char/applicom.c | 16 +++++++++++----- drivers/char/hpet.c | 12 +++++++----- 2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 05674fe..3651e18 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -104,8 +104,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_write (struct file *, const char __user *, size_t, loff_t *); -static int ac_ioctl(struct inode *, struct file *, unsigned int, - unsigned long); +static long ac_ioctl(struct file *, unsigned int, unsigned long); static irqreturn_t ac_interrupt(int, void *); static const struct file_operations ac_fops = { @@ -113,7 +112,7 @@ static const struct file_operations ac_fops = { .llseek = no_llseek, .read = ac_read, .write = ac_write, - .ioctl = ac_ioctl, + .unlocked_ioctl = ac_ioctl, }; static struct miscdevice ac_miscdev = { @@ -687,7 +686,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 */ int i; @@ -698,15 +697,20 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un struct st_ram_io *adgl; void __user *argp = (void __user *)arg; + lock_kernel(); + /* In general, the device is only openable by root anyway, so we're not particularly concerned that bogus ioctls can flood the console. */ adgl = kmalloc(sizeof(struct st_ram_io), GFP_KERNEL); - if (!adgl) + if (!adgl) { + unlock_kernel(); return -ENOMEM; + } if (copy_from_user(adgl, argp, sizeof(struct st_ram_io))) { kfree(adgl); + unlock_kernel(); return -EFAULT; } @@ -719,6 +723,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un warncount--; } kfree(adgl); + unlock_kernel(); return -EINVAL; } @@ -836,6 +841,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } Dummy = readb(apbs[IndexCard].RamIO + VERS); kfree(adgl); + unlock_kernel(); return 0; } diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 32b8bbf..8be216b 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -433,14 +433,16 @@ 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(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) +static long +hpet_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { + lock_kernel(); struct hpet_dev *devp; devp = file->private_data; - return hpet_ioctl_common(devp, cmd, arg, 0); + int ret = hpet_ioctl_common(devp, cmd, arg, 0); + unlock_kernel(); + return ret; } static int hpet_ioctl_ieon(struct hpet_dev *devp) @@ -652,7 +654,7 @@ static const struct file_operations hpet_fops = { .llseek = no_llseek, .read = hpet_read, .poll = hpet_poll, - .ioctl = hpet_ioctl, + .unlocked_ioctl = hpet_ioctl, .open = hpet_open, .release = hpet_release, .fasync = hpet_fasync, -- 1.6.2
| |