summaryrefslogtreecommitdiffstats
path: root/kernel/jump_label.c
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2012-02-21 15:02:53 -0500
committerIngo Molnar <mingo@elte.hu>2012-02-22 07:59:39 +0100
commitfadf0464b83f91ba021a358c0238a0810c0d2a0b (patch)
tree9c02e2959d590b3db212c10452fa45c26324485d /kernel/jump_label.c
parent09bda4432a8a4d4db2b2b94697abc8d732a9ff73 (diff)
downloadlinux-fadf0464b83f91ba021a358c0238a0810c0d2a0b.tar.gz
linux-fadf0464b83f91ba021a358c0238a0810c0d2a0b.tar.bz2
linux-fadf0464b83f91ba021a358c0238a0810c0d2a0b.zip
jump label: Add a WARN() if jump label key count goes negative
The count on a jump label key should never go negative. Add a WARN() to check for this condition. Signed-off-by: Jason Baron <jbaron@redhat.com> Cc: Gleb Natapov <gleb@redhat.com> Cc: rostedt@goodmis.org Cc: mathieu.desnoyers@efficios.com Cc: davem@davemloft.net Cc: ddaney.cavm@gmail.com Cc: a.p.zijlstra@chello.nl Link: http://lkml.kernel.org/r/3c68556121be4d1920417a3fe367da1ec38246b4.1329851692.git.jbaron@redhat.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/jump_label.c')
-rw-r--r--kernel/jump_label.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 01d3b70fc98a..ed9654fd7d27 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -76,8 +76,11 @@ EXPORT_SYMBOL_GPL(jump_label_inc);
static void __jump_label_dec(struct jump_label_key *key,
unsigned long rate_limit, struct delayed_work *work)
{
- if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex))
+ if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex)) {
+ WARN(atomic_read(&key->enabled) < 0,
+ "jump label: negative count!\n");
return;
+ }
if (rate_limit) {
atomic_inc(&key->enabled);