Commit 6c0f8bc77233d000a34a01989c42e650c8c32180

Authored by Stoyan Gaydarov
Committed by David S. Miller
1 parent c7cb1521b3

sbus: changed ioctls to unlocked

Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 13 additions and 9 deletions Side-by-side Diff

drivers/sbus/char/jsflash.c
... ... @@ -383,18 +383,22 @@
383 383 return 0;
384 384 }
385 385  
386   -static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd,
387   - unsigned long arg)
  386 +static long jsf_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
388 387 {
  388 + lock_kernel();
389 389 int error = -ENOTTY;
390 390 void __user *argp = (void __user *)arg;
391 391  
392   - if (!capable(CAP_SYS_ADMIN))
  392 + if (!capable(CAP_SYS_ADMIN)) {
  393 + unlock_kernel();
393 394 return -EPERM;
  395 + }
394 396 switch (cmd) {
395 397 case JSFLASH_IDENT:
396   - if (copy_to_user(argp, &jsf0.id, JSFIDSZ))
  398 + if (copy_to_user(argp, &jsf0.id, JSFIDSZ)) {
  399 + unlock_kernel();
397 400 return -EFAULT;
  401 + }
398 402 break;
399 403 case JSFLASH_ERASE:
400 404 error = jsf_ioctl_erase(arg);
... ... @@ -404,6 +408,7 @@
404 408 break;
405 409 }
406 410  
  411 + unlock_kernel();
407 412 return error;
408 413 }
409 414  
... ... @@ -439,7 +444,7 @@
439 444 .llseek = jsf_lseek,
440 445 .read = jsf_read,
441 446 .write = jsf_write,
442   - .ioctl = jsf_ioctl,
  447 + .unlocked_ioctl = jsf_ioctl,
443 448 .mmap = jsf_mmap,
444 449 .open = jsf_open,
445 450 .release = jsf_release,
drivers/sbus/char/uctrl.c
... ... @@ -197,9 +197,8 @@
197 197 static void uctrl_get_event_status(struct uctrl_driver *);
198 198 static void uctrl_get_external_status(struct uctrl_driver *);
199 199  
200   -static int
201   -uctrl_ioctl(struct inode *inode, struct file *file,
202   - unsigned int cmd, unsigned long arg)
  200 +static long
  201 +uctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
203 202 {
204 203 switch (cmd) {
205 204 default:
... ... @@ -226,7 +225,7 @@
226 225 static const struct file_operations uctrl_fops = {
227 226 .owner = THIS_MODULE,
228 227 .llseek = no_llseek,
229   - .ioctl = uctrl_ioctl,
  228 + .unlocked_ioctl = uctrl_ioctl,
230 229 .open = uctrl_open,
231 230 };
232 231