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 265b37690421..24d1ef56cd95 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -433,11 +433,12 @@ static DEFINE_MUTEX(reboot_mutex);
433SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, 433SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
434 void __user *, arg) 434 void __user *, arg)
435{ 435{
436 struct pid_namespace *pid_ns = task_active_pid_ns(current);
436 char buffer[256]; 437 char buffer[256];
437 int ret = 0; 438 int ret = 0;
438 439
439 /* We only trust the superuser with rebooting the system. */ 440 /* We only trust the superuser with rebooting the system. */
440 if (!capable(CAP_SYS_BOOT)) 441 if (!ns_capable(pid_ns->user_ns, CAP_SYS_BOOT))
441 return -EPERM; 442 return -EPERM;
442 443
443 /* For safety, we require "magic" arguments. */ 444 /* For safety, we require "magic" arguments. */
@@ -453,7 +454,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
453 * pid_namespace, the command is handled by reboot_pid_ns() which will 454 * pid_namespace, the command is handled by reboot_pid_ns() which will
454 * call do_exit(). 455 * call do_exit().
455 */ 456 */
456 ret = reboot_pid_ns(task_active_pid_ns(current), cmd); 457 ret = reboot_pid_ns(pid_ns, cmd);
457 if (ret) 458 if (ret)
458 return ret; 459 return ret;
459 460