aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index e6567d7f2b62..8f3debc77c5b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -23,6 +23,7 @@
23#include <linux/syscalls.h> 23#include <linux/syscalls.h>
24#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/posix-timers.h> 25#include <linux/posix-timers.h>
26#include <linux/signal.h>
26#include <asm/param.h> 27#include <asm/param.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <asm/unistd.h> 29#include <asm/unistd.h>
@@ -646,7 +647,7 @@ static int check_kill_permission(int sig, struct siginfo *info,
646 struct task_struct *t) 647 struct task_struct *t)
647{ 648{
648 int error = -EINVAL; 649 int error = -EINVAL;
649 if (sig < 0 || sig > _NSIG) 650 if (!valid_signal(sig))
650 return error; 651 return error;
651 error = -EPERM; 652 error = -EPERM;
652 if ((!info || ((unsigned long)info != 1 && 653 if ((!info || ((unsigned long)info != 1 &&
@@ -1245,7 +1246,7 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1245 * Make sure legacy kernel users don't send in bad values 1246 * Make sure legacy kernel users don't send in bad values
1246 * (normal paths check this in check_kill_permission). 1247 * (normal paths check this in check_kill_permission).
1247 */ 1248 */
1248 if (sig < 0 || sig > _NSIG) 1249 if (!valid_signal(sig))
1249 return -EINVAL; 1250 return -EINVAL;
1250 1251
1251 /* 1252 /*
@@ -1520,7 +1521,7 @@ void do_notify_parent(struct task_struct *tsk, int sig)
1520 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) 1521 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
1521 sig = 0; 1522 sig = 0;
1522 } 1523 }
1523 if (sig > 0 && sig <= _NSIG) 1524 if (valid_signal(sig) && sig > 0)
1524 __group_send_sig_info(sig, &info, tsk->parent); 1525 __group_send_sig_info(sig, &info, tsk->parent);
1525 __wake_up_parent(tsk, tsk->parent); 1526 __wake_up_parent(tsk, tsk->parent);
1526 spin_unlock_irqrestore(&psig->siglock, flags); 1527 spin_unlock_irqrestore(&psig->siglock, flags);
@@ -2364,7 +2365,7 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2364{ 2365{
2365 struct k_sigaction *k; 2366 struct k_sigaction *k;
2366 2367
2367 if (sig < 1 || sig > _NSIG || (act && sig_kernel_only(sig))) 2368 if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))
2368 return -EINVAL; 2369 return -EINVAL;
2369 2370
2370 k = &current->sighand->action[sig-1]; 2371 k = &current->sighand->action[sig-1];