aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/jsflash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sbus/char/jsflash.c')
-rw-r--r--drivers/sbus/char/jsflash.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index e6d1fc8c54f..a85ad05e854 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -383,18 +383,22 @@ static int jsf_ioctl_program(void __user *arg)
383 return 0; 383 return 0;
384} 384}
385 385
386static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd, 386static long jsf_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
387 unsigned long arg)
388{ 387{
388 lock_kernel();
389 int error = -ENOTTY; 389 int error = -ENOTTY;
390 void __user *argp = (void __user *)arg; 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 return -EPERM; 394 return -EPERM;
395 }
394 switch (cmd) { 396 switch (cmd) {
395 case JSFLASH_IDENT: 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 return -EFAULT; 400 return -EFAULT;
401 }
398 break; 402 break;
399 case JSFLASH_ERASE: 403 case JSFLASH_ERASE:
400 error = jsf_ioctl_erase(arg); 404 error = jsf_ioctl_erase(arg);
@@ -404,6 +408,7 @@ static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd,
404 break; 408 break;
405 } 409 }
406 410
411 unlock_kernel();
407 return error; 412 return error;
408} 413}
409 414
@@ -439,7 +444,7 @@ static const struct file_operations jsf_fops = {
439 .llseek = jsf_lseek, 444 .llseek = jsf_lseek,
440 .read = jsf_read, 445 .read = jsf_read,
441 .write = jsf_write, 446 .write = jsf_write,
442 .ioctl = jsf_ioctl, 447 .unlocked_ioctl = jsf_ioctl,
443 .mmap = jsf_mmap, 448 .mmap = jsf_mmap,
444 .open = jsf_open, 449 .open = jsf_open,
445 .release = jsf_release, 450 .release = jsf_release,