diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs/root.c | 67 | ||||
-rw-r--r-- | fs/autofs4/root.c | 49 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 36 | ||||
-rw-r--r-- | fs/ecryptfs/file.c | 60 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 94 | ||||
-rw-r--r-- | fs/ecryptfs/messaging.c | 2 | ||||
-rw-r--r-- | fs/ncpfs/ioctl.c | 1 |
7 files changed, 231 insertions, 78 deletions
diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 9a0520b50663..11b1ea786d00 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/param.h> | 17 | #include <linux/param.h> |
18 | #include <linux/time.h> | 18 | #include <linux/time.h> |
19 | #include <linux/compat.h> | ||
19 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
20 | #include "autofs_i.h" | 21 | #include "autofs_i.h" |
21 | 22 | ||
@@ -25,13 +26,17 @@ static int autofs_root_symlink(struct inode *,struct dentry *,const char *); | |||
25 | static int autofs_root_unlink(struct inode *,struct dentry *); | 26 | static int autofs_root_unlink(struct inode *,struct dentry *); |
26 | static int autofs_root_rmdir(struct inode *,struct dentry *); | 27 | static int autofs_root_rmdir(struct inode *,struct dentry *); |
27 | static int autofs_root_mkdir(struct inode *,struct dentry *,int); | 28 | static int autofs_root_mkdir(struct inode *,struct dentry *,int); |
28 | static int autofs_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long); | 29 | static long autofs_root_ioctl(struct file *,unsigned int,unsigned long); |
30 | static long autofs_root_compat_ioctl(struct file *,unsigned int,unsigned long); | ||
29 | 31 | ||
30 | const struct file_operations autofs_root_operations = { | 32 | const struct file_operations autofs_root_operations = { |
31 | .llseek = generic_file_llseek, | 33 | .llseek = generic_file_llseek, |
32 | .read = generic_read_dir, | 34 | .read = generic_read_dir, |
33 | .readdir = autofs_root_readdir, | 35 | .readdir = autofs_root_readdir, |
34 | .ioctl = autofs_root_ioctl, | 36 | .unlocked_ioctl = autofs_root_ioctl, |
37 | #ifdef CONFIG_COMPAT | ||
38 | .compat_ioctl = autofs_root_compat_ioctl, | ||
39 | #endif | ||
35 | }; | 40 | }; |
36 | 41 | ||
37 | const struct inode_operations autofs_root_inode_operations = { | 42 | const struct inode_operations autofs_root_inode_operations = { |
@@ -492,6 +497,25 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
492 | } | 497 | } |
493 | 498 | ||
494 | /* Get/set timeout ioctl() operation */ | 499 | /* Get/set timeout ioctl() operation */ |
500 | #ifdef CONFIG_COMPAT | ||
501 | static inline int autofs_compat_get_set_timeout(struct autofs_sb_info *sbi, | ||
502 | unsigned int __user *p) | ||
503 | { | ||
504 | unsigned long ntimeout; | ||
505 | |||
506 | if (get_user(ntimeout, p) || | ||
507 | put_user(sbi->exp_timeout / HZ, p)) | ||
508 | return -EFAULT; | ||
509 | |||
510 | if (ntimeout > UINT_MAX/HZ) | ||
511 | sbi->exp_timeout = 0; | ||
512 | else | ||
513 | sbi->exp_timeout = ntimeout * HZ; | ||
514 | |||
515 | return 0; | ||
516 | } | ||
517 | #endif | ||
518 | |||
495 | static inline int autofs_get_set_timeout(struct autofs_sb_info *sbi, | 519 | static inline int autofs_get_set_timeout(struct autofs_sb_info *sbi, |
496 | unsigned long __user *p) | 520 | unsigned long __user *p) |
497 | { | 521 | { |
@@ -546,7 +570,7 @@ static inline int autofs_expire_run(struct super_block *sb, | |||
546 | * ioctl()'s on the root directory is the chief method for the daemon to | 570 | * ioctl()'s on the root directory is the chief method for the daemon to |
547 | * generate kernel reactions | 571 | * generate kernel reactions |
548 | */ | 572 | */ |
549 | static int autofs_root_ioctl(struct inode *inode, struct file *filp, | 573 | static int autofs_do_root_ioctl(struct inode *inode, struct file *filp, |
550 | unsigned int cmd, unsigned long arg) | 574 | unsigned int cmd, unsigned long arg) |
551 | { | 575 | { |
552 | struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); | 576 | struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); |
@@ -571,6 +595,10 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp, | |||
571 | return 0; | 595 | return 0; |
572 | case AUTOFS_IOC_PROTOVER: /* Get protocol version */ | 596 | case AUTOFS_IOC_PROTOVER: /* Get protocol version */ |
573 | return autofs_get_protover(argp); | 597 | return autofs_get_protover(argp); |
598 | #ifdef CONFIG_COMPAT | ||
599 | case AUTOFS_IOC_SETTIMEOUT32: | ||
600 | return autofs_compat_get_set_timeout(sbi, argp); | ||
601 | #endif | ||
574 | case AUTOFS_IOC_SETTIMEOUT: | 602 | case AUTOFS_IOC_SETTIMEOUT: |
575 | return autofs_get_set_timeout(sbi, argp); | 603 | return autofs_get_set_timeout(sbi, argp); |
576 | case AUTOFS_IOC_EXPIRE: | 604 | case AUTOFS_IOC_EXPIRE: |
@@ -579,4 +607,37 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp, | |||
579 | default: | 607 | default: |
580 | return -ENOSYS; | 608 | return -ENOSYS; |
581 | } | 609 | } |
610 | |||
611 | } | ||
612 | |||
613 | static long autofs_root_ioctl(struct file *filp, | ||
614 | unsigned int cmd, unsigned long arg) | ||
615 | { | ||
616 | int ret; | ||
617 | |||
618 | lock_kernel(); | ||
619 | ret = autofs_do_root_ioctl(filp->f_path.dentry->d_inode, | ||
620 | filp, cmd, arg); | ||
621 | unlock_kernel(); | ||
622 | |||
623 | return ret; | ||
624 | } | ||
625 | |||
626 | #ifdef CONFIG_COMPAT | ||
627 | static long autofs_root_compat_ioctl(struct file *filp, | ||
628 | unsigned int cmd, unsigned long arg) | ||
629 | { | ||
630 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
631 | int ret; | ||
632 | |||
633 | lock_kernel(); | ||
634 | if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) | ||
635 | ret = autofs_do_root_ioctl(inode, filp, cmd, arg); | ||
636 | else | ||
637 | ret = autofs_do_root_ioctl(inode, filp, cmd, | ||
638 | (unsigned long)compat_ptr(arg)); | ||
639 | unlock_kernel(); | ||
640 | |||
641 | return ret; | ||
582 | } | 642 | } |
643 | #endif | ||
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index db4117ed7803..48e056e70fd6 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -18,7 +18,9 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/param.h> | 19 | #include <linux/param.h> |
20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
21 | #include <linux/compat.h> | ||
21 | #include <linux/smp_lock.h> | 22 | #include <linux/smp_lock.h> |
23 | |||
22 | #include "autofs_i.h" | 24 | #include "autofs_i.h" |
23 | 25 | ||
24 | static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); | 26 | static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); |
@@ -26,6 +28,7 @@ static int autofs4_dir_unlink(struct inode *,struct dentry *); | |||
26 | static int autofs4_dir_rmdir(struct inode *,struct dentry *); | 28 | static int autofs4_dir_rmdir(struct inode *,struct dentry *); |
27 | static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); | 29 | static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); |
28 | static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); | 30 | static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); |
31 | static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); | ||
29 | static int autofs4_dir_open(struct inode *inode, struct file *file); | 32 | static int autofs4_dir_open(struct inode *inode, struct file *file); |
30 | static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); | 33 | static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); |
31 | static void *autofs4_follow_link(struct dentry *, struct nameidata *); | 34 | static void *autofs4_follow_link(struct dentry *, struct nameidata *); |
@@ -40,6 +43,9 @@ const struct file_operations autofs4_root_operations = { | |||
40 | .readdir = dcache_readdir, | 43 | .readdir = dcache_readdir, |
41 | .llseek = dcache_dir_lseek, | 44 | .llseek = dcache_dir_lseek, |
42 | .unlocked_ioctl = autofs4_root_ioctl, | 45 | .unlocked_ioctl = autofs4_root_ioctl, |
46 | #ifdef CONFIG_COMPAT | ||
47 | .compat_ioctl = autofs4_root_compat_ioctl, | ||
48 | #endif | ||
43 | }; | 49 | }; |
44 | 50 | ||
45 | const struct file_operations autofs4_dir_operations = { | 51 | const struct file_operations autofs4_dir_operations = { |
@@ -840,6 +846,26 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
840 | } | 846 | } |
841 | 847 | ||
842 | /* Get/set timeout ioctl() operation */ | 848 | /* Get/set timeout ioctl() operation */ |
849 | #ifdef CONFIG_COMPAT | ||
850 | static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, | ||
851 | compat_ulong_t __user *p) | ||
852 | { | ||
853 | int rv; | ||
854 | unsigned long ntimeout; | ||
855 | |||
856 | if ((rv = get_user(ntimeout, p)) || | ||
857 | (rv = put_user(sbi->exp_timeout/HZ, p))) | ||
858 | return rv; | ||
859 | |||
860 | if (ntimeout > UINT_MAX/HZ) | ||
861 | sbi->exp_timeout = 0; | ||
862 | else | ||
863 | sbi->exp_timeout = ntimeout * HZ; | ||
864 | |||
865 | return 0; | ||
866 | } | ||
867 | #endif | ||
868 | |||
843 | static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, | 869 | static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, |
844 | unsigned long __user *p) | 870 | unsigned long __user *p) |
845 | { | 871 | { |
@@ -933,6 +959,10 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, | |||
933 | return autofs4_get_protosubver(sbi, p); | 959 | return autofs4_get_protosubver(sbi, p); |
934 | case AUTOFS_IOC_SETTIMEOUT: | 960 | case AUTOFS_IOC_SETTIMEOUT: |
935 | return autofs4_get_set_timeout(sbi, p); | 961 | return autofs4_get_set_timeout(sbi, p); |
962 | #ifdef CONFIG_COMPAT | ||
963 | case AUTOFS_IOC_SETTIMEOUT32: | ||
964 | return autofs4_compat_get_set_timeout(sbi, p); | ||
965 | #endif | ||
936 | 966 | ||
937 | case AUTOFS_IOC_ASKUMOUNT: | 967 | case AUTOFS_IOC_ASKUMOUNT: |
938 | return autofs4_ask_umount(filp->f_path.mnt, p); | 968 | return autofs4_ask_umount(filp->f_path.mnt, p); |
@@ -961,3 +991,22 @@ static long autofs4_root_ioctl(struct file *filp, | |||
961 | 991 | ||
962 | return ret; | 992 | return ret; |
963 | } | 993 | } |
994 | |||
995 | #ifdef CONFIG_COMPAT | ||
996 | static long autofs4_root_compat_ioctl(struct file *filp, | ||
997 | unsigned int cmd, unsigned long arg) | ||
998 | { | ||
999 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
1000 | int ret; | ||
1001 | |||
1002 | lock_kernel(); | ||
1003 | if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) | ||
1004 | ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); | ||
1005 | else | ||
1006 | ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, | ||
1007 | (unsigned long)compat_ptr(arg)); | ||
1008 | unlock_kernel(); | ||
1009 | |||
1010 | return ret; | ||
1011 | } | ||
1012 | #endif | ||
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index fa4bc48810fd..70227e0dc01d 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -131,23 +131,6 @@ static int w_long(unsigned int fd, unsigned int cmd, | |||
131 | return err; | 131 | return err; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int rw_long(unsigned int fd, unsigned int cmd, | ||
135 | compat_ulong_t __user *argp) | ||
136 | { | ||
137 | mm_segment_t old_fs = get_fs(); | ||
138 | int err; | ||
139 | unsigned long val; | ||
140 | |||
141 | if(get_user(val, argp)) | ||
142 | return -EFAULT; | ||
143 | set_fs (KERNEL_DS); | ||
144 | err = sys_ioctl(fd, cmd, (unsigned long)&val); | ||
145 | set_fs (old_fs); | ||
146 | if (!err && put_user(val, argp)) | ||
147 | return -EFAULT; | ||
148 | return err; | ||
149 | } | ||
150 | |||
151 | struct compat_video_event { | 134 | struct compat_video_event { |
152 | int32_t type; | 135 | int32_t type; |
153 | compat_time_t timestamp; | 136 | compat_time_t timestamp; |
@@ -594,12 +577,6 @@ static int do_smb_getmountuid(unsigned int fd, unsigned int cmd, | |||
594 | return err; | 577 | return err; |
595 | } | 578 | } |
596 | 579 | ||
597 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, | ||
598 | compat_ulong_t __user *argp) | ||
599 | { | ||
600 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, argp); | ||
601 | } | ||
602 | |||
603 | /* Bluetooth ioctls */ | 580 | /* Bluetooth ioctls */ |
604 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 581 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
605 | #define HCIUARTGETPROTO _IOR('U', 201, int) | 582 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
@@ -1285,13 +1262,6 @@ COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5) | |||
1285 | COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS) | 1262 | COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS) |
1286 | COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS) | 1263 | COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS) |
1287 | COMPATIBLE_IOCTL(OSS_GETVERSION) | 1264 | COMPATIBLE_IOCTL(OSS_GETVERSION) |
1288 | /* AUTOFS */ | ||
1289 | COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC) | ||
1290 | COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER) | ||
1291 | COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE) | ||
1292 | COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI) | ||
1293 | COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER) | ||
1294 | COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT) | ||
1295 | /* Raw devices */ | 1265 | /* Raw devices */ |
1296 | COMPATIBLE_IOCTL(RAW_SETBIND) | 1266 | COMPATIBLE_IOCTL(RAW_SETBIND) |
1297 | COMPATIBLE_IOCTL(RAW_GETBIND) | 1267 | COMPATIBLE_IOCTL(RAW_GETBIND) |
@@ -1558,9 +1528,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd, | |||
1558 | case RAW_GETBIND: | 1528 | case RAW_GETBIND: |
1559 | return raw_ioctl(fd, cmd, argp); | 1529 | return raw_ioctl(fd, cmd, argp); |
1560 | #endif | 1530 | #endif |
1561 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | ||
1562 | case AUTOFS_IOC_SETTIMEOUT32: | ||
1563 | return ioc_settimeout(fd, cmd, argp); | ||
1564 | /* One SMB ioctl needs translations. */ | 1531 | /* One SMB ioctl needs translations. */ |
1565 | #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) | 1532 | #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) |
1566 | case SMB_IOC_GETMOUNTUID_32: | 1533 | case SMB_IOC_GETMOUNTUID_32: |
@@ -1615,9 +1582,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd, | |||
1615 | case KDSKBMETA: | 1582 | case KDSKBMETA: |
1616 | case KDSKBLED: | 1583 | case KDSKBLED: |
1617 | case KDSETLED: | 1584 | case KDSETLED: |
1618 | /* AUTOFS */ | ||
1619 | case AUTOFS_IOC_READY: | ||
1620 | case AUTOFS_IOC_FAIL: | ||
1621 | /* NBD */ | 1585 | /* NBD */ |
1622 | case NBD_SET_SOCK: | 1586 | case NBD_SET_SOCK: |
1623 | case NBD_SET_BLKSIZE: | 1587 | case NBD_SET_BLKSIZE: |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index e8fcf4e2ed7d..622c95140802 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -199,7 +199,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
199 | "the persistent file for the dentry with name " | 199 | "the persistent file for the dentry with name " |
200 | "[%s]; rc = [%d]\n", __func__, | 200 | "[%s]; rc = [%d]\n", __func__, |
201 | ecryptfs_dentry->d_name.name, rc); | 201 | ecryptfs_dentry->d_name.name, rc); |
202 | goto out; | 202 | goto out_free; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) | 205 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) |
@@ -207,7 +207,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
207 | rc = -EPERM; | 207 | rc = -EPERM; |
208 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " | 208 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " |
209 | "file must hence be opened RO\n", __func__); | 209 | "file must hence be opened RO\n", __func__); |
210 | goto out; | 210 | goto out_free; |
211 | } | 211 | } |
212 | ecryptfs_set_file_lower( | 212 | ecryptfs_set_file_lower( |
213 | file, ecryptfs_inode_to_private(inode)->lower_file); | 213 | file, ecryptfs_inode_to_private(inode)->lower_file); |
@@ -292,12 +292,40 @@ static int ecryptfs_fasync(int fd, struct file *file, int flag) | |||
292 | return rc; | 292 | return rc; |
293 | } | 293 | } |
294 | 294 | ||
295 | static int ecryptfs_ioctl(struct inode *inode, struct file *file, | 295 | static long |
296 | unsigned int cmd, unsigned long arg); | 296 | ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
297 | { | ||
298 | struct file *lower_file = NULL; | ||
299 | long rc = -ENOTTY; | ||
300 | |||
301 | if (ecryptfs_file_to_private(file)) | ||
302 | lower_file = ecryptfs_file_to_lower(file); | ||
303 | if (lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl) | ||
304 | rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); | ||
305 | return rc; | ||
306 | } | ||
307 | |||
308 | #ifdef CONFIG_COMPAT | ||
309 | static long | ||
310 | ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
311 | { | ||
312 | struct file *lower_file = NULL; | ||
313 | long rc = -ENOIOCTLCMD; | ||
314 | |||
315 | if (ecryptfs_file_to_private(file)) | ||
316 | lower_file = ecryptfs_file_to_lower(file); | ||
317 | if (lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl) | ||
318 | rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); | ||
319 | return rc; | ||
320 | } | ||
321 | #endif | ||
297 | 322 | ||
298 | const struct file_operations ecryptfs_dir_fops = { | 323 | const struct file_operations ecryptfs_dir_fops = { |
299 | .readdir = ecryptfs_readdir, | 324 | .readdir = ecryptfs_readdir, |
300 | .ioctl = ecryptfs_ioctl, | 325 | .unlocked_ioctl = ecryptfs_unlocked_ioctl, |
326 | #ifdef CONFIG_COMPAT | ||
327 | .compat_ioctl = ecryptfs_compat_ioctl, | ||
328 | #endif | ||
301 | .open = ecryptfs_open, | 329 | .open = ecryptfs_open, |
302 | .flush = ecryptfs_flush, | 330 | .flush = ecryptfs_flush, |
303 | .release = ecryptfs_release, | 331 | .release = ecryptfs_release, |
@@ -313,7 +341,10 @@ const struct file_operations ecryptfs_main_fops = { | |||
313 | .write = do_sync_write, | 341 | .write = do_sync_write, |
314 | .aio_write = generic_file_aio_write, | 342 | .aio_write = generic_file_aio_write, |
315 | .readdir = ecryptfs_readdir, | 343 | .readdir = ecryptfs_readdir, |
316 | .ioctl = ecryptfs_ioctl, | 344 | .unlocked_ioctl = ecryptfs_unlocked_ioctl, |
345 | #ifdef CONFIG_COMPAT | ||
346 | .compat_ioctl = ecryptfs_compat_ioctl, | ||
347 | #endif | ||
317 | .mmap = generic_file_mmap, | 348 | .mmap = generic_file_mmap, |
318 | .open = ecryptfs_open, | 349 | .open = ecryptfs_open, |
319 | .flush = ecryptfs_flush, | 350 | .flush = ecryptfs_flush, |
@@ -322,20 +353,3 @@ const struct file_operations ecryptfs_main_fops = { | |||
322 | .fasync = ecryptfs_fasync, | 353 | .fasync = ecryptfs_fasync, |
323 | .splice_read = generic_file_splice_read, | 354 | .splice_read = generic_file_splice_read, |
324 | }; | 355 | }; |
325 | |||
326 | static int | ||
327 | ecryptfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
328 | unsigned long arg) | ||
329 | { | ||
330 | int rc = 0; | ||
331 | struct file *lower_file = NULL; | ||
332 | |||
333 | if (ecryptfs_file_to_private(file)) | ||
334 | lower_file = ecryptfs_file_to_lower(file); | ||
335 | if (lower_file && lower_file->f_op && lower_file->f_op->ioctl) | ||
336 | rc = lower_file->f_op->ioctl(ecryptfs_inode_to_lower(inode), | ||
337 | lower_file, cmd, arg); | ||
338 | else | ||
339 | rc = -ENOTTY; | ||
340 | return rc; | ||
341 | } | ||
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 82900b063b1e..6c55113e7222 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -264,7 +264,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
264 | printk(KERN_ERR "%s: Out of memory whilst attempting " | 264 | printk(KERN_ERR "%s: Out of memory whilst attempting " |
265 | "to allocate ecryptfs_dentry_info struct\n", | 265 | "to allocate ecryptfs_dentry_info struct\n", |
266 | __func__); | 266 | __func__); |
267 | goto out_dput; | 267 | goto out_put; |
268 | } | 268 | } |
269 | ecryptfs_set_dentry_lower(ecryptfs_dentry, lower_dentry); | 269 | ecryptfs_set_dentry_lower(ecryptfs_dentry, lower_dentry); |
270 | ecryptfs_set_dentry_lower_mnt(ecryptfs_dentry, lower_mnt); | 270 | ecryptfs_set_dentry_lower_mnt(ecryptfs_dentry, lower_mnt); |
@@ -339,14 +339,85 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
339 | out_free_kmem: | 339 | out_free_kmem: |
340 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); | 340 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); |
341 | goto out; | 341 | goto out; |
342 | out_dput: | 342 | out_put: |
343 | dput(lower_dentry); | 343 | dput(lower_dentry); |
344 | mntput(lower_mnt); | ||
344 | d_drop(ecryptfs_dentry); | 345 | d_drop(ecryptfs_dentry); |
345 | out: | 346 | out: |
346 | return rc; | 347 | return rc; |
347 | } | 348 | } |
348 | 349 | ||
349 | /** | 350 | /** |
351 | * ecryptfs_new_lower_dentry | ||
352 | * @ename: The name of the new dentry. | ||
353 | * @lower_dir_dentry: Parent directory of the new dentry. | ||
354 | * @nd: nameidata from last lookup. | ||
355 | * | ||
356 | * Create a new dentry or get it from lower parent dir. | ||
357 | */ | ||
358 | static struct dentry * | ||
359 | ecryptfs_new_lower_dentry(struct qstr *name, struct dentry *lower_dir_dentry, | ||
360 | struct nameidata *nd) | ||
361 | { | ||
362 | struct dentry *new_dentry; | ||
363 | struct dentry *tmp; | ||
364 | struct inode *lower_dir_inode; | ||
365 | |||
366 | lower_dir_inode = lower_dir_dentry->d_inode; | ||
367 | |||
368 | tmp = d_alloc(lower_dir_dentry, name); | ||
369 | if (!tmp) | ||
370 | return ERR_PTR(-ENOMEM); | ||
371 | |||
372 | mutex_lock(&lower_dir_inode->i_mutex); | ||
373 | new_dentry = lower_dir_inode->i_op->lookup(lower_dir_inode, tmp, nd); | ||
374 | mutex_unlock(&lower_dir_inode->i_mutex); | ||
375 | |||
376 | if (!new_dentry) | ||
377 | new_dentry = tmp; | ||
378 | else | ||
379 | dput(tmp); | ||
380 | |||
381 | return new_dentry; | ||
382 | } | ||
383 | |||
384 | |||
385 | /** | ||
386 | * ecryptfs_lookup_one_lower | ||
387 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up | ||
388 | * @lower_dir_dentry: lower parent directory | ||
389 | * | ||
390 | * Get the lower dentry from vfs. If lower dentry does not exist yet, | ||
391 | * create it. | ||
392 | */ | ||
393 | static struct dentry * | ||
394 | ecryptfs_lookup_one_lower(struct dentry *ecryptfs_dentry, | ||
395 | struct dentry *lower_dir_dentry) | ||
396 | { | ||
397 | struct nameidata nd; | ||
398 | struct vfsmount *lower_mnt; | ||
399 | struct qstr *name; | ||
400 | int err; | ||
401 | |||
402 | name = &ecryptfs_dentry->d_name; | ||
403 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( | ||
404 | ecryptfs_dentry->d_parent)); | ||
405 | err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd); | ||
406 | mntput(lower_mnt); | ||
407 | |||
408 | if (!err) { | ||
409 | /* we dont need the mount */ | ||
410 | mntput(nd.path.mnt); | ||
411 | return nd.path.dentry; | ||
412 | } | ||
413 | if (err != -ENOENT) | ||
414 | return ERR_PTR(err); | ||
415 | |||
416 | /* create a new lower dentry */ | ||
417 | return ecryptfs_new_lower_dentry(name, lower_dir_dentry, &nd); | ||
418 | } | ||
419 | |||
420 | /** | ||
350 | * ecryptfs_lookup | 421 | * ecryptfs_lookup |
351 | * @ecryptfs_dir_inode: The eCryptfs directory inode | 422 | * @ecryptfs_dir_inode: The eCryptfs directory inode |
352 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up | 423 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up |
@@ -373,14 +444,12 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
373 | goto out_d_drop; | 444 | goto out_d_drop; |
374 | } | 445 | } |
375 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); | 446 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); |
376 | mutex_lock(&lower_dir_dentry->d_inode->i_mutex); | 447 | |
377 | lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, | 448 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, |
378 | lower_dir_dentry, | 449 | lower_dir_dentry); |
379 | ecryptfs_dentry->d_name.len); | ||
380 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); | ||
381 | if (IS_ERR(lower_dentry)) { | 450 | if (IS_ERR(lower_dentry)) { |
382 | rc = PTR_ERR(lower_dentry); | 451 | rc = PTR_ERR(lower_dentry); |
383 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " | 452 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " |
384 | "[%d] on lower_dentry = [%s]\n", __func__, rc, | 453 | "[%d] on lower_dentry = [%s]\n", __func__, rc, |
385 | encrypted_and_encoded_name); | 454 | encrypted_and_encoded_name); |
386 | goto out_d_drop; | 455 | goto out_d_drop; |
@@ -402,14 +471,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
402 | "filename; rc = [%d]\n", __func__, rc); | 471 | "filename; rc = [%d]\n", __func__, rc); |
403 | goto out_d_drop; | 472 | goto out_d_drop; |
404 | } | 473 | } |
405 | mutex_lock(&lower_dir_dentry->d_inode->i_mutex); | 474 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, |
406 | lower_dentry = lookup_one_len(encrypted_and_encoded_name, | 475 | lower_dir_dentry); |
407 | lower_dir_dentry, | ||
408 | encrypted_and_encoded_name_size - 1); | ||
409 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); | ||
410 | if (IS_ERR(lower_dentry)) { | 476 | if (IS_ERR(lower_dentry)) { |
411 | rc = PTR_ERR(lower_dentry); | 477 | rc = PTR_ERR(lower_dentry); |
412 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " | 478 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " |
413 | "[%d] on lower_dentry = [%s]\n", __func__, rc, | 479 | "[%d] on lower_dentry = [%s]\n", __func__, rc, |
414 | encrypted_and_encoded_name); | 480 | encrypted_and_encoded_name); |
415 | goto out_d_drop; | 481 | goto out_d_drop; |
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c index 46c4dd8dfcc3..bcb68c0cb1f0 100644 --- a/fs/ecryptfs/messaging.c +++ b/fs/ecryptfs/messaging.c | |||
@@ -274,7 +274,7 @@ int ecryptfs_process_response(struct ecryptfs_message *msg, uid_t euid, | |||
274 | struct user_namespace *user_ns, struct pid *pid, | 274 | struct user_namespace *user_ns, struct pid *pid, |
275 | u32 seq) | 275 | u32 seq) |
276 | { | 276 | { |
277 | struct ecryptfs_daemon *daemon; | 277 | struct ecryptfs_daemon *uninitialized_var(daemon); |
278 | struct ecryptfs_msg_ctx *msg_ctx; | 278 | struct ecryptfs_msg_ctx *msg_ctx; |
279 | size_t msg_size; | 279 | size_t msg_size; |
280 | struct nsproxy *nsproxy; | 280 | struct nsproxy *nsproxy; |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index 023c03d02070..84a8cfc4e38e 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp_lock.h> | ||
24 | 23 | ||
25 | #include <linux/ncp_fs.h> | 24 | #include <linux/ncp_fs.h> |
26 | 25 | ||