diff options
Diffstat (limited to 'kernel/sys.c')
| -rw-r--r-- | kernel/sys.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 241507f23eca..e6e0ece5f6a0 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -368,6 +368,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier); | |||
| 368 | void kernel_restart(char *cmd) | 368 | void kernel_restart(char *cmd) |
| 369 | { | 369 | { |
| 370 | kernel_restart_prepare(cmd); | 370 | kernel_restart_prepare(cmd); |
| 371 | disable_nonboot_cpus(); | ||
| 371 | if (!cmd) | 372 | if (!cmd) |
| 372 | printk(KERN_EMERG "Restarting system.\n"); | 373 | printk(KERN_EMERG "Restarting system.\n"); |
| 373 | else | 374 | else |
| @@ -1264,15 +1265,16 @@ DECLARE_RWSEM(uts_sem); | |||
| 1264 | * Work around broken programs that cannot handle "Linux 3.0". | 1265 | * Work around broken programs that cannot handle "Linux 3.0". |
| 1265 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 | 1266 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 |
| 1266 | */ | 1267 | */ |
| 1267 | static int override_release(char __user *release, int len) | 1268 | static int override_release(char __user *release, size_t len) |
| 1268 | { | 1269 | { |
| 1269 | int ret = 0; | 1270 | int ret = 0; |
| 1270 | char buf[65]; | ||
| 1271 | 1271 | ||
| 1272 | if (current->personality & UNAME26) { | 1272 | if (current->personality & UNAME26) { |
| 1273 | char *rest = UTS_RELEASE; | 1273 | const char *rest = UTS_RELEASE; |
| 1274 | char buf[65] = { 0 }; | ||
| 1274 | int ndots = 0; | 1275 | int ndots = 0; |
| 1275 | unsigned v; | 1276 | unsigned v; |
| 1277 | size_t copy; | ||
| 1276 | 1278 | ||
| 1277 | while (*rest) { | 1279 | while (*rest) { |
| 1278 | if (*rest == '.' && ++ndots >= 3) | 1280 | if (*rest == '.' && ++ndots >= 3) |
| @@ -1282,8 +1284,9 @@ static int override_release(char __user *release, int len) | |||
| 1282 | rest++; | 1284 | rest++; |
| 1283 | } | 1285 | } |
| 1284 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; | 1286 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; |
| 1285 | snprintf(buf, len, "2.6.%u%s", v, rest); | 1287 | copy = clamp_t(size_t, len, 1, sizeof(buf)); |
| 1286 | ret = copy_to_user(release, buf, len); | 1288 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); |
| 1289 | ret = copy_to_user(release, buf, copy + 1); | ||
| 1287 | } | 1290 | } |
| 1288 | return ret; | 1291 | return ret; |
| 1289 | } | 1292 | } |
| @@ -1788,15 +1791,15 @@ SYSCALL_DEFINE1(umask, int, mask) | |||
| 1788 | #ifdef CONFIG_CHECKPOINT_RESTORE | 1791 | #ifdef CONFIG_CHECKPOINT_RESTORE |
| 1789 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | 1792 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) |
| 1790 | { | 1793 | { |
| 1791 | struct file *exe_file; | 1794 | struct fd exe; |
| 1792 | struct dentry *dentry; | 1795 | struct dentry *dentry; |
| 1793 | int err; | 1796 | int err; |
| 1794 | 1797 | ||
| 1795 | exe_file = fget(fd); | 1798 | exe = fdget(fd); |
| 1796 | if (!exe_file) | 1799 | if (!exe.file) |
| 1797 | return -EBADF; | 1800 | return -EBADF; |
| 1798 | 1801 | ||
| 1799 | dentry = exe_file->f_path.dentry; | 1802 | dentry = exe.file->f_path.dentry; |
| 1800 | 1803 | ||
| 1801 | /* | 1804 | /* |
| 1802 | * Because the original mm->exe_file points to executable file, make | 1805 | * Because the original mm->exe_file points to executable file, make |
| @@ -1805,7 +1808,7 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
| 1805 | */ | 1808 | */ |
| 1806 | err = -EACCES; | 1809 | err = -EACCES; |
| 1807 | if (!S_ISREG(dentry->d_inode->i_mode) || | 1810 | if (!S_ISREG(dentry->d_inode->i_mode) || |
| 1808 | exe_file->f_path.mnt->mnt_flags & MNT_NOEXEC) | 1811 | exe.file->f_path.mnt->mnt_flags & MNT_NOEXEC) |
| 1809 | goto exit; | 1812 | goto exit; |
| 1810 | 1813 | ||
| 1811 | err = inode_permission(dentry->d_inode, MAY_EXEC); | 1814 | err = inode_permission(dentry->d_inode, MAY_EXEC); |
| @@ -1839,12 +1842,12 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
| 1839 | goto exit_unlock; | 1842 | goto exit_unlock; |
| 1840 | 1843 | ||
| 1841 | err = 0; | 1844 | err = 0; |
| 1842 | set_mm_exe_file(mm, exe_file); | 1845 | set_mm_exe_file(mm, exe.file); /* this grabs a reference to exe.file */ |
| 1843 | exit_unlock: | 1846 | exit_unlock: |
| 1844 | up_write(&mm->mmap_sem); | 1847 | up_write(&mm->mmap_sem); |
| 1845 | 1848 | ||
| 1846 | exit: | 1849 | exit: |
| 1847 | fput(exe_file); | 1850 | fdput(exe); |
| 1848 | return err; | 1851 | return err; |
| 1849 | } | 1852 | } |
| 1850 | 1853 | ||
| @@ -2204,7 +2207,7 @@ static int __orderly_poweroff(void) | |||
| 2204 | return -ENOMEM; | 2207 | return -ENOMEM; |
| 2205 | } | 2208 | } |
| 2206 | 2209 | ||
| 2207 | ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_NO_WAIT, | 2210 | ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_WAIT_EXEC, |
| 2208 | NULL, argv_cleanup, NULL); | 2211 | NULL, argv_cleanup, NULL); |
| 2209 | if (ret == -ENOMEM) | 2212 | if (ret == -ENOMEM) |
| 2210 | argv_free(argv); | 2213 | argv_free(argv); |
