Skip to content

Commit 7f8af7b

Browse files
KAGA-KOKOFrederic Weisbecker
authored andcommitted
signal: Replace BUG_ON()s
These really can be handled gracefully without killing the machine. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Reviewed-by: Oleg Nesterov <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]>
1 parent a2b80ce commit 7f8af7b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

kernel/signal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,10 +1938,11 @@ struct sigqueue *sigqueue_alloc(void)
19381938

19391939
void sigqueue_free(struct sigqueue *q)
19401940
{
1941-
unsigned long flags;
19421941
spinlock_t *lock = &current->sighand->siglock;
1942+
unsigned long flags;
19431943

1944-
BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
1944+
if (WARN_ON_ONCE(!(q->flags & SIGQUEUE_PREALLOC)))
1945+
return;
19451946
/*
19461947
* We must hold ->siglock while testing q->list
19471948
* to serialize with collect_signal() or with
@@ -1969,7 +1970,10 @@ int send_sigqueue(struct sigqueue *q, struct pid *pid, enum pid_type type)
19691970
unsigned long flags;
19701971
int ret, result;
19711972

1972-
BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
1973+
if (WARN_ON_ONCE(!(q->flags & SIGQUEUE_PREALLOC)))
1974+
return 0;
1975+
if (WARN_ON_ONCE(q->info.si_code != SI_TIMER))
1976+
return 0;
19731977

19741978
ret = -1;
19751979
rcu_read_lock();
@@ -2004,7 +2008,6 @@ int send_sigqueue(struct sigqueue *q, struct pid *pid, enum pid_type type)
20042008
* If an SI_TIMER entry is already queue just increment
20052009
* the overrun count.
20062010
*/
2007-
BUG_ON(q->info.si_code != SI_TIMER);
20082011
q->info.si_overrun++;
20092012
result = TRACE_SIGNAL_ALREADY_PENDING;
20102013
goto out;

0 commit comments

Comments
 (0)