Commit ce8273a573918612cbd320597db3d5dd89578454

Authored by Arnd Bergmann
Committed by Frederic Weisbecker
1 parent 977183902a

smbfs: Push down BKL into ioctl function

Converting from ->ioctl to ->unlocked_ioctl with explicit
lock_kernel lets us kill the ioctl operation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[fixed inode reference in smb_ioctl]
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>

Showing 4 changed files with 9 additions and 7 deletions Side-by-side Diff

... ... @@ -39,7 +39,7 @@
39 39 {
40 40 .read = generic_read_dir,
41 41 .readdir = smb_readdir,
42   - .ioctl = smb_ioctl,
  42 + .unlocked_ioctl = smb_ioctl,
43 43 .open = smb_dir_open,
44 44 };
45 45  
... ... @@ -437,7 +437,7 @@
437 437 .aio_read = smb_file_aio_read,
438 438 .write = do_sync_write,
439 439 .aio_write = smb_file_aio_write,
440   - .ioctl = smb_ioctl,
  440 + .unlocked_ioctl = smb_ioctl,
441 441 .mmap = smb_file_mmap,
442 442 .open = smb_file_open,
443 443 .release = smb_file_release,
... ... @@ -13,6 +13,7 @@
13 13 #include <linux/time.h>
14 14 #include <linux/mm.h>
15 15 #include <linux/highuid.h>
  16 +#include <linux/smp_lock.h>
16 17 #include <linux/net.h>
17 18  
18 19 #include <linux/smb_fs.h>
19 20  
20 21  
... ... @@ -22,14 +23,14 @@
22 23  
23 24 #include "proto.h"
24 25  
25   -int
26   -smb_ioctl(struct inode *inode, struct file *filp,
27   - unsigned int cmd, unsigned long arg)
  26 +long
  27 +smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
28 28 {
29   - struct smb_sb_info *server = server_from_inode(inode);
  29 + struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);
30 30 struct smb_conn_opt opt;
31 31 int result = -EINVAL;
32 32  
  33 + lock_kernel();
33 34 switch (cmd) {
34 35 uid16_t uid16;
35 36 uid_t uid32;
... ... @@ -62,6 +63,7 @@
62 63 default:
63 64 break;
64 65 }
  66 + unlock_kernel();
65 67  
66 68 return result;
67 69 }
... ... @@ -67,7 +67,7 @@
67 67 extern const struct file_operations smb_file_operations;
68 68 extern const struct inode_operations smb_file_inode_operations;
69 69 /* ioctl.c */
70   -extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
  70 +extern long smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
71 71 /* smbiod.c */
72 72 extern void smbiod_wake_up(void);
73 73 extern int smbiod_register_server(struct smb_sb_info *server);