aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-06-01 13:34:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-06-01 13:34:35 -0400
commit1193755ac6328ad240ba987e6ec41d5e8baf0680 (patch)
tree40bf847d7e3ebaa57b107151d14e6cd1d280cc6d /fs/compat.c
parent4edebed86690eb8db9af3ab85baf4a34e73266cc (diff)
parent0ef97dcfce4179a2eba046b855ee2f91d6f1b414 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs changes from Al Viro. "A lot of misc stuff. The obvious groups: * Miklos' atomic_open series; kills the damn abuse of ->d_revalidate() by NFS, which was the major stumbling block for all work in that area. * ripping security_file_mmap() and dealing with deadlocks in the area; sanitizing the neighborhood of vm_mmap()/vm_munmap() in general. * ->encode_fh() switched to saner API; insane fake dentry in mm/cleancache.c gone. * assorted annotations in fs (endianness, __user) * parts of Artem's ->s_dirty work (jff2 and reiserfs parts) * ->update_time() work from Josef. * other bits and pieces all over the place. Normally it would've been in two or three pull requests, but signal.git stuff had eaten a lot of time during this cycle ;-/" Fix up trivial conflicts in Documentation/filesystems/vfs.txt (the 'truncate_range' inode method was removed by the VM changes, the VFS update adds an 'update_time()' method), and in fs/btrfs/ulist.[ch] (due to sparse fix added twice, with other changes nearby). * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (95 commits) nfs: don't open in ->d_revalidate vfs: retry last component if opening stale dentry vfs: nameidata_to_filp(): don't throw away file on error vfs: nameidata_to_filp(): inline __dentry_open() vfs: do_dentry_open(): don't put filp vfs: split __dentry_open() vfs: do_last() common post lookup vfs: do_last(): add audit_inode before open vfs: do_last(): only return EISDIR for O_CREAT vfs: do_last(): check LOOKUP_DIRECTORY vfs: do_last(): make ENOENT exit RCU safe vfs: make follow_link check RCU safe vfs: do_last(): use inode variable vfs: do_last(): inline walk_component() vfs: do_last(): make exit RCU safe vfs: split do_lookup() Btrfs: move over to use ->update_time fs: introduce inode operation ->update_time reiserfs: get rid of resierfs_sync_super reiserfs: mark the superblock as dirty a bit later ...
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 6556a9ce8a28..3004d2bad13f 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -871,12 +871,12 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
871{ 871{
872 int error; 872 int error;
873 struct file *file; 873 struct file *file;
874 int fput_needed;
874 struct compat_readdir_callback buf; 875 struct compat_readdir_callback buf;
875 876
876 error = -EBADF; 877 file = fget_light(fd, &fput_needed);
877 file = fget(fd);
878 if (!file) 878 if (!file)
879 goto out; 879 return -EBADF;
880 880
881 buf.result = 0; 881 buf.result = 0;
882 buf.dirent = dirent; 882 buf.dirent = dirent;
@@ -885,8 +885,7 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
885 if (buf.result) 885 if (buf.result)
886 error = buf.result; 886 error = buf.result;
887 887
888 fput(file); 888 fput_light(file, fput_needed);
889out:
890 return error; 889 return error;
891} 890}
892 891
@@ -953,16 +952,15 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
953 struct file * file; 952 struct file * file;
954 struct compat_linux_dirent __user * lastdirent; 953 struct compat_linux_dirent __user * lastdirent;
955 struct compat_getdents_callback buf; 954 struct compat_getdents_callback buf;
955 int fput_needed;
956 int error; 956 int error;
957 957
958 error = -EFAULT;
959 if (!access_ok(VERIFY_WRITE, dirent, count)) 958 if (!access_ok(VERIFY_WRITE, dirent, count))
960 goto out; 959 return -EFAULT;
961 960
962 error = -EBADF; 961 file = fget_light(fd, &fput_needed);
963 file = fget(fd);
964 if (!file) 962 if (!file)
965 goto out; 963 return -EBADF;
966 964
967 buf.current_dir = dirent; 965 buf.current_dir = dirent;
968 buf.previous = NULL; 966 buf.previous = NULL;
@@ -979,8 +977,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
979 else 977 else
980 error = count - buf.count; 978 error = count - buf.count;
981 } 979 }
982 fput(file); 980 fput_light(file, fput_needed);
983out:
984 return error; 981 return error;
985} 982}
986 983
@@ -1041,16 +1038,15 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
1041 struct file * file; 1038 struct file * file;
1042 struct linux_dirent64 __user * lastdirent; 1039 struct linux_dirent64 __user * lastdirent;
1043 struct compat_getdents_callback64 buf; 1040 struct compat_getdents_callback64 buf;
1041 int fput_needed;
1044 int error; 1042 int error;
1045 1043
1046 error = -EFAULT;
1047 if (!access_ok(VERIFY_WRITE, dirent, count)) 1044 if (!access_ok(VERIFY_WRITE, dirent, count))
1048 goto out; 1045 return -EFAULT;
1049 1046
1050 error = -EBADF; 1047 file = fget_light(fd, &fput_needed);
1051 file = fget(fd);
1052 if (!file) 1048 if (!file)
1053 goto out; 1049 return -EBADF;
1054 1050
1055 buf.current_dir = dirent; 1051 buf.current_dir = dirent;
1056 buf.previous = NULL; 1052 buf.previous = NULL;
@@ -1068,8 +1064,7 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
1068 else 1064 else
1069 error = count - buf.count; 1065 error = count - buf.count;
1070 } 1066 }
1071 fput(file); 1067 fput_light(file, fput_needed);
1072out:
1073 return error; 1068 return error;
1074} 1069}
1075#endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */ 1070#endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */