lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <163766531684.11128.7984508732175783489.tip-bot2@tip-bot2>
Date:   Tue, 23 Nov 2021 11:01:56 -0000
From:   "tip-bot2 for Andrey Ryabinin" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Andrey Ryabinin <arbn@...dex-team.com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Daniel Jordan <daniel.m.jordan@...cle.com>,
        Tejun Heo <tj@...nel.org>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: sched/core] cpuacct: Convert BUG_ON() to WARN_ON_ONCE()

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     c7ccbf4b6174e32c130892570db06d0f496cfef0
Gitweb:        https://git.kernel.org/tip/c7ccbf4b6174e32c130892570db06d0f496cfef0
Author:        Andrey Ryabinin <arbn@...dex-team.com>
AuthorDate:    Mon, 15 Nov 2021 19:46:05 +03:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Tue, 23 Nov 2021 09:55:22 +01:00

cpuacct: Convert BUG_ON() to WARN_ON_ONCE()

Replace fatal BUG_ON() with more safe WARN_ON_ONCE() in cpuacct_cpuusage_read().

Signed-off-by: Andrey Ryabinin <arbn@...dex-team.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Daniel Jordan <daniel.m.jordan@...cle.com>
Acked-by: Tejun Heo <tj@...nel.org>
Link: https://lore.kernel.org/r/20211115164607.23784-2-arbn@yandex-team.com
---
 kernel/sched/cpuacct.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 893eece..f347cf9 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -106,7 +106,8 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu,
 	 * We allow index == CPUACCT_STAT_NSTATS here to read
 	 * the sum of usages.
 	 */
-	BUG_ON(index > CPUACCT_STAT_NSTATS);
+	if (WARN_ON_ONCE(index > CPUACCT_STAT_NSTATS))
+		return 0;
 
 #ifndef CONFIG_64BIT
 	/*

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ