diff options
Diffstat (limited to 'kernel/sysctl_binary.c')
-rw-r--r-- | kernel/sysctl_binary.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index 1357c5786064..3b8e028b9601 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
@@ -136,7 +136,6 @@ static const struct bin_table bin_kern_table[] = { | |||
136 | { CTL_INT, KERN_IA64_UNALIGNED, "ignore-unaligned-usertrap" }, | 136 | { CTL_INT, KERN_IA64_UNALIGNED, "ignore-unaligned-usertrap" }, |
137 | { CTL_INT, KERN_COMPAT_LOG, "compat-log" }, | 137 | { CTL_INT, KERN_COMPAT_LOG, "compat-log" }, |
138 | { CTL_INT, KERN_MAX_LOCK_DEPTH, "max_lock_depth" }, | 138 | { CTL_INT, KERN_MAX_LOCK_DEPTH, "max_lock_depth" }, |
139 | { CTL_INT, KERN_NMI_WATCHDOG, "nmi_watchdog" }, | ||
140 | { CTL_INT, KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" }, | 139 | { CTL_INT, KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" }, |
141 | {} | 140 | {} |
142 | }; | 141 | }; |
@@ -1193,7 +1192,7 @@ static ssize_t bin_dn_node_address(struct file *file, | |||
1193 | 1192 | ||
1194 | buf[result] = '\0'; | 1193 | buf[result] = '\0'; |
1195 | 1194 | ||
1196 | /* Convert the decnet addresss to binary */ | 1195 | /* Convert the decnet address to binary */ |
1197 | result = -EIO; | 1196 | result = -EIO; |
1198 | nodep = strchr(buf, '.') + 1; | 1197 | nodep = strchr(buf, '.') + 1; |
1199 | if (!nodep) | 1198 | if (!nodep) |
@@ -1322,13 +1321,11 @@ static ssize_t binary_sysctl(const int *name, int nlen, | |||
1322 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | 1321 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
1323 | { | 1322 | { |
1324 | const struct bin_table *table = NULL; | 1323 | const struct bin_table *table = NULL; |
1325 | struct nameidata nd; | ||
1326 | struct vfsmount *mnt; | 1324 | struct vfsmount *mnt; |
1327 | struct file *file; | 1325 | struct file *file; |
1328 | ssize_t result; | 1326 | ssize_t result; |
1329 | char *pathname; | 1327 | char *pathname; |
1330 | int flags; | 1328 | int flags; |
1331 | int acc_mode; | ||
1332 | 1329 | ||
1333 | pathname = sysctl_getname(name, nlen, &table); | 1330 | pathname = sysctl_getname(name, nlen, &table); |
1334 | result = PTR_ERR(pathname); | 1331 | result = PTR_ERR(pathname); |
@@ -1338,28 +1335,17 @@ static ssize_t binary_sysctl(const int *name, int nlen, | |||
1338 | /* How should the sysctl be accessed? */ | 1335 | /* How should the sysctl be accessed? */ |
1339 | if (oldval && oldlen && newval && newlen) { | 1336 | if (oldval && oldlen && newval && newlen) { |
1340 | flags = O_RDWR; | 1337 | flags = O_RDWR; |
1341 | acc_mode = MAY_READ | MAY_WRITE; | ||
1342 | } else if (newval && newlen) { | 1338 | } else if (newval && newlen) { |
1343 | flags = O_WRONLY; | 1339 | flags = O_WRONLY; |
1344 | acc_mode = MAY_WRITE; | ||
1345 | } else if (oldval && oldlen) { | 1340 | } else if (oldval && oldlen) { |
1346 | flags = O_RDONLY; | 1341 | flags = O_RDONLY; |
1347 | acc_mode = MAY_READ; | ||
1348 | } else { | 1342 | } else { |
1349 | result = 0; | 1343 | result = 0; |
1350 | goto out_putname; | 1344 | goto out_putname; |
1351 | } | 1345 | } |
1352 | 1346 | ||
1353 | mnt = current->nsproxy->pid_ns->proc_mnt; | 1347 | mnt = current->nsproxy->pid_ns->proc_mnt; |
1354 | result = vfs_path_lookup(mnt->mnt_root, mnt, pathname, 0, &nd); | 1348 | file = file_open_root(mnt->mnt_root, mnt, pathname, flags); |
1355 | if (result) | ||
1356 | goto out_putname; | ||
1357 | |||
1358 | result = may_open(&nd.path, acc_mode, flags); | ||
1359 | if (result) | ||
1360 | goto out_putpath; | ||
1361 | |||
1362 | file = dentry_open(nd.path.dentry, nd.path.mnt, flags, current_cred()); | ||
1363 | result = PTR_ERR(file); | 1349 | result = PTR_ERR(file); |
1364 | if (IS_ERR(file)) | 1350 | if (IS_ERR(file)) |
1365 | goto out_putname; | 1351 | goto out_putname; |
@@ -1371,10 +1357,6 @@ out_putname: | |||
1371 | putname(pathname); | 1357 | putname(pathname); |
1372 | out: | 1358 | out: |
1373 | return result; | 1359 | return result; |
1374 | |||
1375 | out_putpath: | ||
1376 | path_put(&nd.path); | ||
1377 | goto out_putname; | ||
1378 | } | 1360 | } |
1379 | 1361 | ||
1380 | 1362 | ||