aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl_binary.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 23:16:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 23:16:07 -0500
commitd895cb1af15c04c522a25c79cc429076987c089b (patch)
tree895dc9157e28f603d937a58be664e4e440d5530c /kernel/sysctl_binary.c
parent9626357371b519f2b955fef399647181034a77fe (diff)
parentd3d009cb965eae7e002ea5badf603ea8f4c34915 (diff)
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() ...
Diffstat (limited to 'kernel/sysctl_binary.c')
-rw-r--r--kernel/sysctl_binary.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index b669ca1fa103..b25115e8c7f3 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -970,7 +970,6 @@ out:
970static ssize_t bin_intvec(struct file *file, 970static ssize_t bin_intvec(struct file *file,
971 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) 971 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
972{ 972{
973 mm_segment_t old_fs = get_fs();
974 ssize_t copied = 0; 973 ssize_t copied = 0;
975 char *buffer; 974 char *buffer;
976 ssize_t result; 975 ssize_t result;
@@ -983,13 +982,10 @@ static ssize_t bin_intvec(struct file *file,
983 if (oldval && oldlen) { 982 if (oldval && oldlen) {
984 unsigned __user *vec = oldval; 983 unsigned __user *vec = oldval;
985 size_t length = oldlen / sizeof(*vec); 984 size_t length = oldlen / sizeof(*vec);
986 loff_t pos = 0;
987 char *str, *end; 985 char *str, *end;
988 int i; 986 int i;
989 987
990 set_fs(KERNEL_DS); 988 result = kernel_read(file, 0, buffer, BUFSZ - 1);
991 result = vfs_read(file, buffer, BUFSZ - 1, &pos);
992 set_fs(old_fs);
993 if (result < 0) 989 if (result < 0)
994 goto out_kfree; 990 goto out_kfree;
995 991
@@ -1016,7 +1012,6 @@ static ssize_t bin_intvec(struct file *file,
1016 if (newval && newlen) { 1012 if (newval && newlen) {
1017 unsigned __user *vec = newval; 1013 unsigned __user *vec = newval;
1018 size_t length = newlen / sizeof(*vec); 1014 size_t length = newlen / sizeof(*vec);
1019 loff_t pos = 0;
1020 char *str, *end; 1015 char *str, *end;
1021 int i; 1016 int i;
1022 1017
@@ -1032,9 +1027,7 @@ static ssize_t bin_intvec(struct file *file,
1032 str += snprintf(str, end - str, "%lu\t", value); 1027 str += snprintf(str, end - str, "%lu\t", value);
1033 } 1028 }
1034 1029
1035 set_fs(KERNEL_DS); 1030 result = kernel_write(file, buffer, str - buffer, 0);
1036 result = vfs_write(file, buffer, str - buffer, &pos);
1037 set_fs(old_fs);
1038 if (result < 0) 1031 if (result < 0)
1039 goto out_kfree; 1032 goto out_kfree;
1040 } 1033 }
@@ -1048,7 +1041,6 @@ out:
1048static ssize_t bin_ulongvec(struct file *file, 1041static ssize_t bin_ulongvec(struct file *file,
1049 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) 1042 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
1050{ 1043{
1051 mm_segment_t old_fs = get_fs();
1052 ssize_t copied = 0; 1044 ssize_t copied = 0;
1053 char *buffer; 1045 char *buffer;
1054 ssize_t result; 1046 ssize_t result;
@@ -1061,13 +1053,10 @@ static ssize_t bin_ulongvec(struct file *file,
1061 if (oldval && oldlen) { 1053 if (oldval && oldlen) {
1062 unsigned long __user *vec = oldval; 1054 unsigned long __user *vec = oldval;
1063 size_t length = oldlen / sizeof(*vec); 1055 size_t length = oldlen / sizeof(*vec);
1064 loff_t pos = 0;
1065 char *str, *end; 1056 char *str, *end;
1066 int i; 1057 int i;
1067 1058
1068 set_fs(KERNEL_DS); 1059 result = kernel_read(file, 0, buffer, BUFSZ - 1);
1069 result = vfs_read(file, buffer, BUFSZ - 1, &pos);
1070 set_fs(old_fs);
1071 if (result < 0) 1060 if (result < 0)
1072 goto out_kfree; 1061 goto out_kfree;
1073 1062
@@ -1094,7 +1083,6 @@ static ssize_t bin_ulongvec(struct file *file,
1094 if (newval && newlen) { 1083 if (newval && newlen) {
1095 unsigned long __user *vec = newval; 1084 unsigned long __user *vec = newval;
1096 size_t length = newlen / sizeof(*vec); 1085 size_t length = newlen / sizeof(*vec);
1097 loff_t pos = 0;
1098 char *str, *end; 1086 char *str, *end;
1099 int i; 1087 int i;
1100 1088
@@ -1110,9 +1098,7 @@ static ssize_t bin_ulongvec(struct file *file,
1110 str += snprintf(str, end - str, "%lu\t", value); 1098 str += snprintf(str, end - str, "%lu\t", value);
1111 } 1099 }
1112 1100
1113 set_fs(KERNEL_DS); 1101 result = kernel_write(file, buffer, str - buffer, 0);
1114 result = vfs_write(file, buffer, str - buffer, &pos);
1115 set_fs(old_fs);
1116 if (result < 0) 1102 if (result < 0)
1117 goto out_kfree; 1103 goto out_kfree;
1118 } 1104 }
@@ -1126,19 +1112,15 @@ out:
1126static ssize_t bin_uuid(struct file *file, 1112static ssize_t bin_uuid(struct file *file,
1127 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) 1113 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
1128{ 1114{
1129 mm_segment_t old_fs = get_fs();
1130 ssize_t result, copied = 0; 1115 ssize_t result, copied = 0;
1131 1116
1132 /* Only supports reads */ 1117 /* Only supports reads */
1133 if (oldval && oldlen) { 1118 if (oldval && oldlen) {
1134 loff_t pos = 0;
1135 char buf[40], *str = buf; 1119 char buf[40], *str = buf;
1136 unsigned char uuid[16]; 1120 unsigned char uuid[16];
1137 int i; 1121 int i;
1138 1122
1139 set_fs(KERNEL_DS); 1123 result = kernel_read(file, 0, buf, sizeof(buf) - 1);
1140 result = vfs_read(file, buf, sizeof(buf) - 1, &pos);
1141 set_fs(old_fs);
1142 if (result < 0) 1124 if (result < 0)
1143 goto out; 1125 goto out;
1144 1126
@@ -1174,18 +1156,14 @@ out:
1174static ssize_t bin_dn_node_address(struct file *file, 1156static ssize_t bin_dn_node_address(struct file *file,
1175 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) 1157 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
1176{ 1158{
1177 mm_segment_t old_fs = get_fs();
1178 ssize_t result, copied = 0; 1159 ssize_t result, copied = 0;
1179 1160
1180 if (oldval && oldlen) { 1161 if (oldval && oldlen) {
1181 loff_t pos = 0;
1182 char buf[15], *nodep; 1162 char buf[15], *nodep;
1183 unsigned long area, node; 1163 unsigned long area, node;
1184 __le16 dnaddr; 1164 __le16 dnaddr;
1185 1165
1186 set_fs(KERNEL_DS); 1166 result = kernel_read(file, 0, buf, sizeof(buf) - 1);
1187 result = vfs_read(file, buf, sizeof(buf) - 1, &pos);
1188 set_fs(old_fs);
1189 if (result < 0) 1167 if (result < 0)
1190 goto out; 1168 goto out;
1191 1169
@@ -1214,7 +1192,6 @@ static ssize_t bin_dn_node_address(struct file *file,
1214 } 1192 }
1215 1193
1216 if (newval && newlen) { 1194 if (newval && newlen) {
1217 loff_t pos = 0;
1218 __le16 dnaddr; 1195 __le16 dnaddr;
1219 char buf[15]; 1196 char buf[15];
1220 int len; 1197 int len;
@@ -1231,9 +1208,7 @@ static ssize_t bin_dn_node_address(struct file *file,
1231 le16_to_cpu(dnaddr) >> 10, 1208 le16_to_cpu(dnaddr) >> 10,
1232 le16_to_cpu(dnaddr) & 0x3ff); 1209 le16_to_cpu(dnaddr) & 0x3ff);
1233 1210
1234 set_fs(KERNEL_DS); 1211 result = kernel_write(file, buf, len, 0);
1235 result = vfs_write(file, buf, len, &pos);
1236 set_fs(old_fs);
1237 if (result < 0) 1212 if (result < 0)
1238 goto out; 1213 goto out;
1239 } 1214 }