diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-09-24 01:23:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-24 16:54:19 -0400 |
commit | a05c4e1d669d09faa90ce7b22646ad1a4b0de3ff (patch) | |
tree | dfb850a66b18d48610aedaed78d2e8003106a852 /arch/m32r/kernel/signal.c | |
parent | a748102430f4dbbfca3ff81ac12db6e4f1243677 (diff) |
m32r: don't block signals if sigframe setup has failed
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m32r/kernel/signal.c')
-rw-r--r-- | arch/m32r/kernel/signal.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index db152263484f..a56fcbd8abe6 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -187,7 +187,7 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) | |||
187 | return (void __user *)((sp - frame_size) & -8ul); | 187 | return (void __user *)((sp - frame_size) & -8ul); |
188 | } | 188 | } |
189 | 189 | ||
190 | static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 190 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
191 | sigset_t *set, struct pt_regs *regs) | 191 | sigset_t *set, struct pt_regs *regs) |
192 | { | 192 | { |
193 | struct rt_sigframe __user *frame; | 193 | struct rt_sigframe __user *frame; |
@@ -244,17 +244,18 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
244 | current->comm, current->pid, frame, regs->pc); | 244 | current->comm, current->pid, frame, regs->pc); |
245 | #endif | 245 | #endif |
246 | 246 | ||
247 | return; | 247 | return 0; |
248 | 248 | ||
249 | give_sigsegv: | 249 | give_sigsegv: |
250 | force_sigsegv(sig, current); | 250 | force_sigsegv(sig, current); |
251 | return -EFAULT; | ||
251 | } | 252 | } |
252 | 253 | ||
253 | /* | 254 | /* |
254 | * OK, we're invoking a handler | 255 | * OK, we're invoking a handler |
255 | */ | 256 | */ |
256 | 257 | ||
257 | static void | 258 | static int |
258 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 259 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
259 | sigset_t *oldset, struct pt_regs *regs) | 260 | sigset_t *oldset, struct pt_regs *regs) |
260 | { | 261 | { |
@@ -287,7 +288,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
287 | } | 288 | } |
288 | 289 | ||
289 | /* Set up the stack frame */ | 290 | /* Set up the stack frame */ |
290 | setup_rt_frame(sig, ka, info, oldset, regs); | 291 | if (setup_rt_frame(sig, ka, info, oldset, regs)) |
292 | return -EFAULT; | ||
291 | 293 | ||
292 | spin_lock_irq(¤t->sighand->siglock); | 294 | spin_lock_irq(¤t->sighand->siglock); |
293 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 295 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
@@ -295,6 +297,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
295 | sigaddset(¤t->blocked,sig); | 297 | sigaddset(¤t->blocked,sig); |
296 | recalc_sigpending(); | 298 | recalc_sigpending(); |
297 | spin_unlock_irq(¤t->sighand->siglock); | 299 | spin_unlock_irq(¤t->sighand->siglock); |
300 | return 0; | ||
298 | } | 301 | } |
299 | 302 | ||
300 | /* | 303 | /* |
@@ -302,7 +305,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
302 | * want to handle. Thus you cannot kill init even with a SIGKILL even by | 305 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
303 | * mistake. | 306 | * mistake. |
304 | */ | 307 | */ |
305 | static int do_signal(struct pt_regs *regs) | 308 | static void do_signal(struct pt_regs *regs) |
306 | { | 309 | { |
307 | siginfo_t info; | 310 | siginfo_t info; |
308 | int signr; | 311 | int signr; |
@@ -317,7 +320,7 @@ static int do_signal(struct pt_regs *regs) | |||
317 | * if so. | 320 | * if so. |
318 | */ | 321 | */ |
319 | if (!user_mode(regs)) | 322 | if (!user_mode(regs)) |
320 | return 1; | 323 | return; |
321 | 324 | ||
322 | if (try_to_freeze()) | 325 | if (try_to_freeze()) |
323 | goto no_signal; | 326 | goto no_signal; |
@@ -336,9 +339,10 @@ static int do_signal(struct pt_regs *regs) | |||
336 | */ | 339 | */ |
337 | 340 | ||
338 | /* Whee! Actually deliver the signal. */ | 341 | /* Whee! Actually deliver the signal. */ |
339 | handle_signal(signr, &ka, &info, oldset, regs); | 342 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) |
340 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 343 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
341 | return 1; | 344 | |
345 | return; | ||
342 | } | 346 | } |
343 | 347 | ||
344 | no_signal: | 348 | no_signal: |
@@ -370,7 +374,6 @@ static int do_signal(struct pt_regs *regs) | |||
370 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 374 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
371 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | 375 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
372 | } | 376 | } |
373 | return 0; | ||
374 | } | 377 | } |
375 | 378 | ||
376 | /* | 379 | /* |