From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C37D628312F; Mon, 9 Feb 2026 14:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648779; cv=none; b=Em45xSoHIrslhrdJ3bfFnW7tnXbz2QPxoQQcsHUvp6ZXKYPA3ohEfr9Dz1YhDus3p8CfSgtLQvsV1JVbzc8jVquAc9MZYZUjfkVNd8Xp7RtBoMN2VgTH6O5rOAWhNg+YEtmt/5GhTyyC7Es+AQwpYTU2sdflZfJzEGemT/si/v8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648779; c=relaxed/simple; bh=cOYV3aAlT3C7k/RfHEdkF08+5SDG3cED5JVRXUGFZgc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ukp/FLHnl4EWUGaqWzKWTOJIzAb0clSvcKiBSESCQ9zHuG8HUEvu1WV5mP5aU/izQU8vU3AfN7cyeZGL1rf8cgWu12pVCbKnZtkiqfaI6ekb4E/L4jleaX0gfpDVgBcaqgM/uYK6ODA2SfrKO1JW1PuL4LzwOHZMuNt+6qdrbBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=r442zhCE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="r442zhCE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31DA5C116C6; Mon, 9 Feb 2026 14:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648779; bh=cOYV3aAlT3C7k/RfHEdkF08+5SDG3cED5JVRXUGFZgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r442zhCE8KWjr6I1gTUGtJ/TY90XBoSKIF43LcPnsJZknoZXTkcJRg3MCGX3BQX9O 9Zsd97xJSW/XsjzOjo3dqPeXSWjRhM4BYg+ZbzmKKOxFM4fiX0xGqUNRZTA/FlVAMy CKHjAo7N50GBZs6z1fN67aJ7q7yFgsezIO8Qlzjw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Gleixner , Guenter Roeck , Jacob Keller , Anna-Maria Behnsen , Jeongjun Park Subject: [PATCH 5.15 13/75] timers: Replace BUG_ON()s Date: Mon, 9 Feb 2026 15:24:10 +0100 Message-ID: <20260209142302.319876788@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142301.830618238@linuxfoundation.org> References: <20260209142301.830618238@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner [ Upstream commit 82ed6f7ef58f9634fe4462dd721902c580f01569 ] The timer code still has a few BUG_ON()s left which are crashing the kernel in situations where it still can recover or simply refuse to take an action. Remove the one in the hotplug callback which checks for the CPU being offline. If that happens then the whole hotplug machinery will explode in colourful ways. Replace the rest with WARN_ON_ONCE() and conditional returns where appropriate. Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201624.769128888@linutronix.de Signed-off-by: Jeongjun Park Signed-off-by: Greg Kroah-Hartman --- kernel/time/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1155,7 +1155,8 @@ EXPORT_SYMBOL(timer_reduce); */ void add_timer(struct timer_list *timer) { - BUG_ON(timer_pending(timer)); + if (WARN_ON_ONCE(timer_pending(timer))) + return; __mod_timer(timer, timer->expires, MOD_TIMER_NOTPENDING); } EXPORT_SYMBOL(add_timer); @@ -1174,7 +1175,8 @@ void add_timer_on(struct timer_list *tim struct timer_base *new_base, *base; unsigned long flags; - BUG_ON(timer_pending(timer) || !timer->function); + if (WARN_ON_ONCE(timer_pending(timer) || !timer->function)) + return; new_base = get_timer_cpu_base(timer->flags, cpu); @@ -1995,8 +1997,6 @@ int timers_dead_cpu(unsigned int cpu) struct timer_base *new_base; int b, i; - BUG_ON(cpu_online(cpu)); - for (b = 0; b < NR_BASES; b++) { old_base = per_cpu_ptr(&timer_bases[b], cpu); new_base = get_cpu_ptr(&timer_bases[b]); @@ -2013,7 +2013,8 @@ int timers_dead_cpu(unsigned int cpu) */ forward_timer_base(new_base); - BUG_ON(old_base->running_timer); + WARN_ON_ONCE(old_base->running_timer); + old_base->running_timer = NULL; for (i = 0; i < WHEEL_SIZE; i++) migrate_timer_list(new_base, old_base->vectors + i);