aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/process_keys.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-09-24 05:35:16 -0400
committerDavid Howells <dhowells@redhat.com>2013-09-24 05:35:16 -0400
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)
235 if (IS_ERR(keyring)) 235 if (IS_ERR(keyring))
236 return PTR_ERR(keyring); 236 return PTR_ERR(keyring);
237 } else { 237 } else {
238 atomic_inc(&keyring->usage); 238 __key_get(keyring);
239 } 239 }
240 240
241 /* install the keyring */ 241 /* install the keyring */
@@ -544,7 +544,7 @@ try_again:
544 } 544 }
545 545
546 key = ctx.cred->thread_keyring; 546 key = ctx.cred->thread_keyring;
547 atomic_inc(&key->usage); 547 __key_get(key);
548 key_ref = make_key_ref(key, 1); 548 key_ref = make_key_ref(key, 1);
549 break; 549 break;
550 550
@@ -562,7 +562,7 @@ try_again:
562 } 562 }
563 563
564 key = ctx.cred->process_keyring; 564 key = ctx.cred->process_keyring;
565 atomic_inc(&key->usage); 565 __key_get(key);
566 key_ref = make_key_ref(key, 1); 566 key_ref = make_key_ref(key, 1);
567 break; 567 break;
568 568
@@ -593,7 +593,7 @@ try_again:
593 593
594 rcu_read_lock(); 594 rcu_read_lock();
595 key = rcu_dereference(ctx.cred->session_keyring); 595 key = rcu_dereference(ctx.cred->session_keyring);
596 atomic_inc(&key->usage); 596 __key_get(key);
597 rcu_read_unlock(); 597 rcu_read_unlock();
598 key_ref = make_key_ref(key, 1); 598 key_ref = make_key_ref(key, 1);
599 break; 599 break;
@@ -606,7 +606,7 @@ try_again:
606 } 606 }
607 607
608 key = ctx.cred->user->uid_keyring; 608 key = ctx.cred->user->uid_keyring;
609 atomic_inc(&key->usage); 609 __key_get(key);
610 key_ref = make_key_ref(key, 1); 610 key_ref = make_key_ref(key, 1);
611 break; 611 break;
612 612
@@ -618,7 +618,7 @@ try_again:
618 } 618 }
619 619
620 key = ctx.cred->user->session_keyring; 620 key = ctx.cred->user->session_keyring;
621 atomic_inc(&key->usage); 621 __key_get(key);
622 key_ref = make_key_ref(key, 1); 622 key_ref = make_key_ref(key, 1);
623 break; 623 break;
624 624
@@ -632,7 +632,7 @@ try_again:
632 if (!key) 632 if (!key)
633 goto error; 633 goto error;
634 634
635 atomic_inc(&key->usage); 635 __key_get(key);
636 key_ref = make_key_ref(key, 1); 636 key_ref = make_key_ref(key, 1);
637 break; 637 break;
638 638
@@ -648,7 +648,7 @@ try_again:
648 } else { 648 } else {
649 rka = ctx.cred->request_key_auth->payload.data; 649 rka = ctx.cred->request_key_auth->payload.data;
650 key = rka->dest_keyring; 650 key = rka->dest_keyring;
651 atomic_inc(&key->usage); 651 __key_get(key);
652 } 652 }
653 up_read(&ctx.cred->request_key_auth->sem); 653 up_read(&ctx.cred->request_key_auth->sem);
654 if (!key) 654 if (!key)