aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 37f458e6882a..e7998cf31498 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -34,6 +34,7 @@
34#include <linux/seccomp.h> 34#include <linux/seccomp.h>
35#include <linux/cpu.h> 35#include <linux/cpu.h>
36#include <linux/ptrace.h> 36#include <linux/ptrace.h>
37#include <linux/fs_struct.h>
37 38
38#include <linux/compat.h> 39#include <linux/compat.h>
39#include <linux/syscalls.h> 40#include <linux/syscalls.h>
@@ -359,6 +360,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
359 void __user *, arg) 360 void __user *, arg)
360{ 361{
361 char buffer[256]; 362 char buffer[256];
363 int ret = 0;
362 364
363 /* We only trust the superuser with rebooting the system. */ 365 /* We only trust the superuser with rebooting the system. */
364 if (!capable(CAP_SYS_BOOT)) 366 if (!capable(CAP_SYS_BOOT))
@@ -396,7 +398,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
396 kernel_halt(); 398 kernel_halt();
397 unlock_kernel(); 399 unlock_kernel();
398 do_exit(0); 400 do_exit(0);
399 break; 401 panic("cannot halt");
400 402
401 case LINUX_REBOOT_CMD_POWER_OFF: 403 case LINUX_REBOOT_CMD_POWER_OFF:
402 kernel_power_off(); 404 kernel_power_off();
@@ -416,29 +418,22 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
416 418
417#ifdef CONFIG_KEXEC 419#ifdef CONFIG_KEXEC
418 case LINUX_REBOOT_CMD_KEXEC: 420 case LINUX_REBOOT_CMD_KEXEC:
419 { 421 ret = kernel_kexec();
420 int ret; 422 break;
421 ret = kernel_kexec();
422 unlock_kernel();
423 return ret;
424 }
425#endif 423#endif
426 424
427#ifdef CONFIG_HIBERNATION 425#ifdef CONFIG_HIBERNATION
428 case LINUX_REBOOT_CMD_SW_SUSPEND: 426 case LINUX_REBOOT_CMD_SW_SUSPEND:
429 { 427 ret = hibernate();
430 int ret = hibernate(); 428 break;
431 unlock_kernel();
432 return ret;
433 }
434#endif 429#endif
435 430
436 default: 431 default:
437 unlock_kernel(); 432 ret = -EINVAL;
438 return -EINVAL; 433 break;
439 } 434 }
440 unlock_kernel(); 435 unlock_kernel();
441 return 0; 436 return ret;
442} 437}
443 438
444static void deferred_cad(struct work_struct *dummy) 439static void deferred_cad(struct work_struct *dummy)
@@ -1013,10 +1008,8 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
1013 if (err) 1008 if (err)
1014 goto out; 1009 goto out;
1015 1010
1016 if (task_pgrp(p) != pgrp) { 1011 if (task_pgrp(p) != pgrp)
1017 change_pid(p, PIDTYPE_PGID, pgrp); 1012 change_pid(p, PIDTYPE_PGID, pgrp);
1018 set_task_pgrp(p, pid_nr(pgrp));
1019 }
1020 1013
1021 err = 0; 1014 err = 0;
1022out: 1015out: