aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 840cfdad7bfc..2e18d33ca775 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -434,11 +434,12 @@ static DEFINE_MUTEX(reboot_mutex);
434SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, 434SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
435 void __user *, arg) 435 void __user *, arg)
436{ 436{
437 struct pid_namespace *pid_ns = task_active_pid_ns(current);
437 char buffer[256]; 438 char buffer[256];
438 int ret = 0; 439 int ret = 0;
439 440
440 /* We only trust the superuser with rebooting the system. */ 441 /* We only trust the superuser with rebooting the system. */
441 if (!capable(CAP_SYS_BOOT)) 442 if (!ns_capable(pid_ns->user_ns, CAP_SYS_BOOT))
442 return -EPERM; 443 return -EPERM;
443 444
444 /* For safety, we require "magic" arguments. */ 445 /* For safety, we require "magic" arguments. */
@@ -454,7 +455,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
454 * pid_namespace, the command is handled by reboot_pid_ns() which will 455 * pid_namespace, the command is handled by reboot_pid_ns() which will
455 * call do_exit(). 456 * call do_exit().
456 */ 457 */
457 ret = reboot_pid_ns(task_active_pid_ns(current), cmd); 458 ret = reboot_pid_ns(pid_ns, cmd);
458 if (ret) 459 if (ret)
459 return ret; 460 return ret;
460 461