History

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs pile (part one) from Al Viro: "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent locking violations, etc. The most visible changes here are death of FS_REVAL_DOT (replaced with "has ->d_weak_revalidate()") and a new helper getting from struct file to inode. Some bits of preparation to xattr method interface changes. Misc patches by various people sent this cycle *and* ocfs2 fixes from several cycles ago that should've been upstream right then. PS: the next vfs pile will be xattr stuff." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits) saner proc_get_inode() calling conventions proc: avoid extra pde_put() in proc_fill_super() fs: change return values from -EACCES to -EPERM fs/exec.c: make bprm_mm_init() static ocfs2/dlm: use GFP_ATOMIC inside a spin_lock ocfs2: fix possible use-after-free with AIO ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero target: writev() on single-element vector is pointless export kernel_write(), convert open-coded instances fs: encode_fh: return FILEID_INVALID if invalid fid_type kill f_vfsmnt vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op nfsd: handle vfs_getattr errors in acl protocol switch vfs_getattr() to struct path default SET_PERSONALITY() in linux/elf.h ceph: prepopulate inodes only when request is aborted d_hash_and_lookup(): export, switch open-coded instances 9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate() 9p: split dropping the acls from v9fs_set_create_acl() ...

Linus Torvalds committed 13 years ago

Commit d895cb12 parents 9626357 d3d009c383 files · +1276 −1423Browse files

Showing the changes to kernel/sysctl_binary.c (1 of 383 files). Show all

Unified · Split

kernel/sysctl_binary.c+7−32
@@ -970,7 +970,6 @@ out: · 969 unmodified lines
970970 static ssize_t bin_intvec(struct file *file,
971971 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
972972 {
973− mm_segment_t old_fs = get_fs();
974973 ssize_t copied = 0;
975974 char *buffer;
976975 ssize_t result;
@@ -983,13 +982,10 @@ static ssize_t bin_intvec(struct file *file, · 6 unmodified lines
983982 if (oldval && oldlen) {
984983 unsigned __user *vec = oldval;
985984 size_t length = oldlen / sizeof(*vec);
986− loff_t pos = 0;
987985 char *str, *end;
988986 int i;
989987
990− set_fs(KERNEL_DS);
991− result = vfs_read(file, buffer, BUFSZ - 1, &pos);
992− set_fs(old_fs);
988+ result = kernel_read(file, 0, buffer, BUFSZ - 1);
993989 if (result < 0)
994990 goto out_kfree;
995991
@@ -1016,7 +1012,6 @@ static ssize_t bin_intvec(struct file *file, · 20 unmodified lines
10161012 if (newval && newlen) {
10171013 unsigned __user *vec = newval;
10181014 size_t length = newlen / sizeof(*vec);
1019− loff_t pos = 0;
10201015 char *str, *end;
10211016 int i;
10221017
@@ -1032,9 +1027,7 @@ static ssize_t bin_intvec(struct file *file, · 9 unmodified lines
10321027 str += snprintf(str, end - str, "%lu\t", value);
10331028 }
10341029
1035− set_fs(KERNEL_DS);
1036− result = vfs_write(file, buffer, str - buffer, &pos);
1037− set_fs(old_fs);
1030+ result = kernel_write(file, buffer, str - buffer, 0);
10381031 if (result < 0)
10391032 goto out_kfree;
10401033 }
@@ -1048,7 +1041,6 @@ out: · 7 unmodified lines
10481041 static ssize_t bin_ulongvec(struct file *file,
10491042 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
10501043 {
1051− mm_segment_t old_fs = get_fs();
10521044 ssize_t copied = 0;
10531045 char *buffer;
10541046 ssize_t result;
@@ -1061,13 +1053,10 @@ static ssize_t bin_ulongvec(struct file *file, · 6 unmodified lines
10611053 if (oldval && oldlen) {
10621054 unsigned long __user *vec = oldval;
10631055 size_t length = oldlen / sizeof(*vec);
1064− loff_t pos = 0;
10651056 char *str, *end;
10661057 int i;
10671058
1068− set_fs(KERNEL_DS);
1069− result = vfs_read(file, buffer, BUFSZ - 1, &pos);
1070− set_fs(old_fs);
1059+ result = kernel_read(file, 0, buffer, BUFSZ - 1);
10711060 if (result < 0)
10721061 goto out_kfree;
10731062
@@ -1094,7 +1083,6 @@ static ssize_t bin_ulongvec(struct file *file, · 20 unmodified lines
10941083 if (newval && newlen) {
10951084 unsigned long __user *vec = newval;
10961085 size_t length = newlen / sizeof(*vec);
1097− loff_t pos = 0;
10981086 char *str, *end;
10991087 int i;
11001088
@@ -1110,9 +1098,7 @@ static ssize_t bin_ulongvec(struct file *file, · 9 unmodified lines
11101098 str += snprintf(str, end - str, "%lu\t", value);
11111099 }
11121100
1113− set_fs(KERNEL_DS);
1114− result = vfs_write(file, buffer, str - buffer, &pos);
1115− set_fs(old_fs);
1101+ result = kernel_write(file, buffer, str - buffer, 0);
11161102 if (result < 0)
11171103 goto out_kfree;
11181104 }
@@ -1126,19 +1112,15 @@ out: · 7 unmodified lines
11261112 static ssize_t bin_uuid(struct file *file,
11271113 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
11281114 {
1129− mm_segment_t old_fs = get_fs();
11301115 ssize_t result, copied = 0;
11311116
11321117 /* Only supports reads */
11331118 if (oldval && oldlen) {
1134− loff_t pos = 0;
11351119 char buf[40], *str = buf;
11361120 unsigned char uuid[16];
11371121 int i;
11381122
1139− set_fs(KERNEL_DS);
1140− result = vfs_read(file, buf, sizeof(buf) - 1, &pos);
1141− set_fs(old_fs);
1123+ result = kernel_read(file, 0, buf, sizeof(buf) - 1);
11421124 if (result < 0)
11431125 goto out;
11441126
@@ -1174,18 +1156,14 @@ out: · 29 unmodified lines
11741156 static ssize_t bin_dn_node_address(struct file *file,
11751157 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
11761158 {
1177− mm_segment_t old_fs = get_fs();
11781159 ssize_t result, copied = 0;
11791160
11801161 if (oldval && oldlen) {
1181− loff_t pos = 0;
11821162 char buf[15], *nodep;
11831163 unsigned long area, node;
11841164 __le16 dnaddr;
11851165
1186− set_fs(KERNEL_DS);
1187− result = vfs_read(file, buf, sizeof(buf) - 1, &pos);
1188− set_fs(old_fs);
1166+ result = kernel_read(file, 0, buf, sizeof(buf) - 1);
11891167 if (result < 0)
11901168 goto out;
11911169
@@ -1214,7 +1192,6 @@ static ssize_t bin_dn_node_address(struct file *file, · 22 unmodified lines
12141192 }
12151193
12161194 if (newval && newlen) {
1217− loff_t pos = 0;
12181195 __le16 dnaddr;
12191196 char buf[15];
12201197 int len;
@@ -1231,9 +1208,7 @@ static ssize_t bin_dn_node_address(struct file *file, · 10 unmodified lines
12311208 le16_to_cpu(dnaddr) >> 10,
12321209 le16_to_cpu(dnaddr) & 0x3ff);
12331210
1234− set_fs(KERNEL_DS);
1235− result = vfs_write(file, buf, len, &pos);
1236− set_fs(old_fs);
1211+ result = kernel_write(file, buf, len, 0);
12371212 if (result < 0)
12381213 goto out;
12391214 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t