summaryrefslogtreecommitdiff
path: root/security/keys/process_keys.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-09-24 10:35:16 +0100
committerDavid Howells <dhowells@redhat.com>2013-09-24 10:35:16 +0100
commitccc3e6d9c9aea07a0b60b2b0bfc5b05a704b66d5 (patch)
treed111175934b1454fa275fe056f8c6d320e504b01 /security/keys/process_keys.c
parentd0a059cac6523b23ad7d743dec8783705aab1668 (diff)
KEYS: Define a __key_get() wrapper to use rather than atomic_inc()
Define a __key_get() wrapper to use rather than atomic_inc() on the key usage count as this makes it easier to hook in refcount error debugging. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/process_keys.c')
-rw-r--r--security/keys/process_keys.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index e68a3e0e7aa0..68548ea6fe01 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -235,7 +235,7 @@ int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
if (IS_ERR(keyring))
return PTR_ERR(keyring);
} else {
- atomic_inc(&keyring->usage);
+ __key_get(keyring);
}
/* install the keyring */
@@ -544,7 +544,7 @@ try_again:
}
key = ctx.cred->thread_keyring;
- atomic_inc(&key->usage);
+ __key_get(key);
key_ref = make_key_ref(key, 1);
break;
@@ -562,7 +562,7 @@ try_again:
}
key = ctx.cred->process_keyring;
- atomic_inc(&key->usage);
+ __key_get(key);
key_ref = make_key_ref(key, 1);
break;
@@ -593,7 +593,7 @@ try_again:
rcu_read_lock();
key = rcu_dereference(ctx.cred->session_keyring);
- atomic_inc(&key->usage);
+ __key_get(key);
rcu_read_unlock();
key_ref = make_key_ref(key, 1);
break;
@@ -606,7 +606,7 @@ try_again:
}
key = ctx.cred->user->uid_keyring;
- atomic_inc(&key->usage);
+ __key_get(key);
key_ref = make_key_ref(key, 1);
break;
@@ -618,7 +618,7 @@ try_again:
}
key = ctx.cred->user->session_keyring;
- atomic_inc(&key->usage);
+ __key_get(key);
key_ref = make_key_ref(key, 1);
break;
@@ -632,7 +632,7 @@ try_again:
if (!key)
goto error;
- atomic_inc(&key->usage);
+ __key_get(key);
key_ref = make_key_ref(key, 1);
break;
@@ -648,7 +648,7 @@ try_again:
} else {
rka = ctx.cred->request_key_auth->payload.data;
key = rka->dest_keyring;
- atomic_inc(&key->usage);
+ __key_get(key);
}
up_read(&ctx.cred->request_key_auth->sem);
if (!key)