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>

authored by Al Viro and committed by Linus Torvalds a05c4e1d a7481024

+13 -10
+13 -10
arch/m32r/kernel/signal.c
··· 187 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 191 sigset_t *set, struct pt_regs *regs) 192 192 { 193 193 struct rt_sigframe __user *frame; ··· 244 244 current->comm, current->pid, frame, regs->pc); 245 245 #endif 246 246 247 - return; 247 + return 0; 248 248 249 249 give_sigsegv: 250 250 force_sigsegv(sig, current); 251 + return -EFAULT; 251 252 } 252 253 253 254 /* 254 255 * OK, we're invoking a handler 255 256 */ 256 257 257 - static void 258 + static int 258 259 handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 259 260 sigset_t *oldset, struct pt_regs *regs) 260 261 { ··· 288 287 } 289 288 290 289 /* Set up the stack frame */ 291 - setup_rt_frame(sig, ka, info, oldset, regs); 290 + if (setup_rt_frame(sig, ka, info, oldset, regs)) 291 + return -EFAULT; 292 292 293 293 spin_lock_irq(&current->sighand->siglock); 294 294 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); ··· 297 295 sigaddset(&current->blocked,sig); 298 296 recalc_sigpending(); 299 297 spin_unlock_irq(&current->sighand->siglock); 298 + return 0; 300 299 } 301 300 302 301 /* ··· 305 302 * want to handle. Thus you cannot kill init even with a SIGKILL even by 306 303 * mistake. 307 304 */ 308 - static int do_signal(struct pt_regs *regs) 305 + static void do_signal(struct pt_regs *regs) 309 306 { 310 307 siginfo_t info; 311 308 int signr; ··· 320 317 * if so. 321 318 */ 322 319 if (!user_mode(regs)) 323 - return 1; 320 + return; 324 321 325 322 if (try_to_freeze()) 326 323 goto no_signal; ··· 339 336 */ 340 337 341 338 /* Whee! Actually deliver the signal. */ 342 - handle_signal(signr, &ka, &info, oldset, regs); 343 - clear_thread_flag(TIF_RESTORE_SIGMASK); 344 - return 1; 339 + if (handle_signal(signr, &ka, &info, oldset, regs) == 0) 340 + clear_thread_flag(TIF_RESTORE_SIGMASK); 341 + 342 + return; 345 343 } 346 344 347 345 no_signal: ··· 374 370 clear_thread_flag(TIF_RESTORE_SIGMASK); 375 371 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 376 372 } 377 - return 0; 378 373 } 379 374 380 375 /*