Skip to contentSkip to conversation

changed ioctls to unlocked

PATCH Applied [email protected] 1 participant 1 message Mar 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 10/13 changed ioctls to unlocked

From: Stoyan Gaydarov <[email protected]>

---
 drivers/char/applicom.c |   16 +++++++++++-----
 drivers/char/hpet.c     |   12 +++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)
drivers/char/applicom.c +11 -5
index 05674fe..3651e18 100644
@@ -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;
 }
 
drivers/char/hpet.c +7 -5
index 32b8bbf..8be216b 100644
@@ -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,
Signature · 1 line
1.6.2