Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Arnd Bergmann and committed by
Frederic Weisbecker
ce8273a5 97718390

+9 -7
+1 -1
fs/smbfs/dir.c
··· 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
+1 -1
fs/smbfs/file.c
··· 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,
+6 -4
fs/smbfs/ioctl.c
··· 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> ··· 23 22 24 23 #include "proto.h" 25 24 26 - int 27 - smb_ioctl(struct inode *inode, struct file *filp, 28 - unsigned int cmd, unsigned long arg) 25 + long 26 + smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 29 27 { 30 - struct smb_sb_info *server = server_from_inode(inode); 28 + struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode); 31 29 struct smb_conn_opt opt; 32 30 int result = -EINVAL; 33 31 32 + lock_kernel(); 34 33 switch (cmd) { 35 34 uid16_t uid16; 36 35 uid_t uid32; ··· 63 62 default: 64 63 break; 65 64 } 65 + unlock_kernel(); 66 66 67 67 return result; 68 68 }
+1 -1
fs/smbfs/proto.h
··· 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);