Skip to content

Commit

Permalink
signal: Replace BUG_ON()s
Browse files Browse the repository at this point in the history
These really can be handled gracefully without killing the machine.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
  • Loading branch information
Thomas Gleixner authored and Frederic Weisbecker committed Jul 29, 2024
1 parent a2b80ce commit 7f8af7b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1938,10 +1938,11 @@ struct sigqueue *sigqueue_alloc(void)

void sigqueue_free(struct sigqueue *q)
{
unsigned long flags;
spinlock_t *lock = &current->sighand->siglock;
unsigned long flags;

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

BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
if (WARN_ON_ONCE(!(q->flags & SIGQUEUE_PREALLOC)))
return 0;
if (WARN_ON_ONCE(q->info.si_code != SI_TIMER))
return 0;

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

0 comments on commit 7f8af7b

Please sign in to comment.