aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/key.c2
-rw-r--r--security/keys/keyring.c6
-rw-r--r--security/keys/process_keys.c16
3 files changed, 12 insertions, 12 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index 7e6bc396bb23..1e23cc288106 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -644,7 +644,7 @@ found:
644 /* this races with key_put(), but that doesn't matter since key_put() 644 /* this races with key_put(), but that doesn't matter since key_put()
645 * doesn't actually change the key 645 * doesn't actually change the key
646 */ 646 */
647 atomic_inc(&key->usage); 647 __key_get(key);
648 648
649error: 649error:
650 spin_unlock(&key_serial_lock); 650 spin_unlock(&key_serial_lock);
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index b42f2d4f7f83..87eff32b53f4 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -479,7 +479,7 @@ not_this_keyring:
479 479
480 /* we found a viable match */ 480 /* we found a viable match */
481found: 481found:
482 atomic_inc(&key->usage); 482 __key_get(key);
483 key->last_used_at = ctx->now.tv_sec; 483 key->last_used_at = ctx->now.tv_sec;
484 keyring->last_used_at = ctx->now.tv_sec; 484 keyring->last_used_at = ctx->now.tv_sec;
485 while (sp > 0) 485 while (sp > 0)
@@ -573,7 +573,7 @@ key_ref_t __keyring_search_one(key_ref_t keyring_ref,
573 return ERR_PTR(-ENOKEY); 573 return ERR_PTR(-ENOKEY);
574 574
575found: 575found:
576 atomic_inc(&key->usage); 576 __key_get(key);
577 keyring->last_used_at = key->last_used_at = 577 keyring->last_used_at = key->last_used_at =
578 current_kernel_time().tv_sec; 578 current_kernel_time().tv_sec;
579 rcu_read_unlock(); 579 rcu_read_unlock();
@@ -909,7 +909,7 @@ void __key_link(struct key *keyring, struct key *key,
909 909
910 klist = rcu_dereference_locked_keyring(keyring); 910 klist = rcu_dereference_locked_keyring(keyring);
911 911
912 atomic_inc(&key->usage); 912 __key_get(key);
913 keyring->last_used_at = key->last_used_at = 913 keyring->last_used_at = key->last_used_at =
914 current_kernel_time().tv_sec; 914 current_kernel_time().tv_sec;
915 915
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)