key_ref 138 include/linux/key.h static inline struct key *key_ref_to_ptr(const key_ref_t key_ref) key_ref 140 include/linux/key.h return (struct key *) ((unsigned long) key_ref & ~1UL); key_ref 143 include/linux/key.h static inline bool is_key_possessed(const key_ref_t key_ref) key_ref 145 include/linux/key.h return (unsigned long) key_ref & 1UL; key_ref 290 include/linux/key.h static inline void key_ref_put(key_ref_t key_ref) key_ref 292 include/linux/key.h key_put(key_ref_to_ptr(key_ref)); key_ref 1797 include/linux/lsm_hooks.h int (*key_permission)(key_ref_t key_ref, const struct cred *cred, key_ref 1745 include/linux/security.h int security_key_permission(key_ref_t key_ref, key_ref 1762 include/linux/security.h static inline int security_key_permission(key_ref_t key_ref, key_ref 20 security/keys/dh.c key_ref_t key_ref; key_ref 24 security/keys/dh.c key_ref = lookup_user_key(keyid, 0, KEY_NEED_READ); key_ref 25 security/keys/dh.c if (IS_ERR(key_ref)) { key_ref 30 security/keys/dh.c key = key_ref_to_ptr(key_ref); key_ref 182 security/keys/internal.h extern int key_task_permission(const key_ref_t key_ref, key_ref 189 security/keys/internal.h static inline int key_permission(const key_ref_t key_ref, unsigned perm) key_ref 191 security/keys/internal.h return key_task_permission(key_ref, current_cred(), perm); key_ref 748 security/keys/key.c static inline key_ref_t __key_update(key_ref_t key_ref, key_ref 751 security/keys/key.c struct key *key = key_ref_to_ptr(key_ref); key_ref 755 security/keys/key.c ret = key_permission(key_ref, KEY_NEED_WRITE); key_ref 775 security/keys/key.c return key_ref; key_ref 779 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 823 security/keys/key.c key_ref_t key_ref; key_ref 831 security/keys/key.c key_ref = ERR_PTR(-ENODEV); key_ref 835 security/keys/key.c key_ref = ERR_PTR(-EINVAL); key_ref 847 security/keys/key.c key_ref = ERR_PTR(-ENOTDIR); key_ref 859 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 864 security/keys/key.c key_ref = ERR_PTR(-EINVAL); key_ref 873 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 879 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 887 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 896 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 905 security/keys/key.c key_ref = find_key_to_update(keyring_ref, &index_key); key_ref 906 security/keys/key.c if (key_ref) key_ref 927 security/keys/key.c key_ref = ERR_CAST(key); key_ref 935 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 939 security/keys/key.c key_ref = make_key_ref(key, is_key_possessed(keyring_ref)); key_ref 949 security/keys/key.c return key_ref; key_ref 957 security/keys/key.c key = key_ref_to_ptr(key_ref); key_ref 961 security/keys/key.c key_ref_put(key_ref); key_ref 962 security/keys/key.c key_ref = ERR_PTR(ret); key_ref 967 security/keys/key.c key_ref = __key_update(key_ref, &prep); key_ref 985 security/keys/key.c int key_update(key_ref_t key_ref, const void *payload, size_t plen) key_ref 988 security/keys/key.c struct key *key = key_ref_to_ptr(key_ref); key_ref 994 security/keys/key.c ret = key_permission(key_ref, KEY_NEED_WRITE); key_ref 78 security/keys/keyctl.c key_ref_t keyring_ref, key_ref; key_ref 132 security/keys/keyctl.c key_ref = key_create_or_update(keyring_ref, type, description, key_ref 135 security/keys/keyctl.c if (!IS_ERR(key_ref)) { key_ref 136 security/keys/keyctl.c ret = key_ref_to_ptr(key_ref)->serial; key_ref 137 security/keys/keyctl.c key_ref_put(key_ref); key_ref 140 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 258 security/keys/keyctl.c key_ref_t key_ref; key_ref 263 security/keys/keyctl.c key_ref = lookup_user_key(id, lflags, KEY_NEED_SEARCH); key_ref 264 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 265 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 269 security/keys/keyctl.c ret = key_ref_to_ptr(key_ref)->serial; key_ref 270 security/keys/keyctl.c key_ref_put(key_ref); key_ref 327 security/keys/keyctl.c key_ref_t key_ref; key_ref 349 security/keys/keyctl.c key_ref = lookup_user_key(id, 0, KEY_NEED_WRITE); key_ref 350 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 351 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 356 security/keys/keyctl.c ret = key_update(key_ref, payload, plen); key_ref 358 security/keys/keyctl.c key_ref_put(key_ref); key_ref 379 security/keys/keyctl.c key_ref_t key_ref; key_ref 383 security/keys/keyctl.c key_ref = lookup_user_key(id, 0, KEY_NEED_WRITE); key_ref 384 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 385 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 388 security/keys/keyctl.c key_ref = lookup_user_key(id, 0, KEY_NEED_SETATTR); key_ref 389 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 390 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 395 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 402 security/keys/keyctl.c key_ref_put(key_ref); key_ref 420 security/keys/keyctl.c key_ref_t key_ref; key_ref 426 security/keys/keyctl.c key_ref = lookup_user_key(id, 0, KEY_NEED_SEARCH); key_ref 427 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 428 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 432 security/keys/keyctl.c key_ref = lookup_user_key(id, 0, 0); key_ref 433 security/keys/keyctl.c if (IS_ERR(key_ref)) key_ref 436 security/keys/keyctl.c &key_ref_to_ptr(key_ref)->flags)) key_ref 445 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 452 security/keys/keyctl.c key_ref_put(key_ref); key_ref 514 security/keys/keyctl.c key_ref_t keyring_ref, key_ref; key_ref 523 security/keys/keyctl.c key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); key_ref 524 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 525 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 529 security/keys/keyctl.c ret = key_link(key_ref_to_ptr(keyring_ref), key_ref_to_ptr(key_ref)); key_ref 531 security/keys/keyctl.c key_ref_put(key_ref); key_ref 551 security/keys/keyctl.c key_ref_t keyring_ref, key_ref; key_ref 561 security/keys/keyctl.c key_ref = lookup_user_key(id, KEY_LOOKUP_FOR_UNLINK, 0); key_ref 562 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 563 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 568 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 575 security/keys/keyctl.c key_ref_put(key_ref); key_ref 595 security/keys/keyctl.c key_ref_t key_ref, from_ref, to_ref; key_ref 601 security/keys/keyctl.c key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); key_ref 602 security/keys/keyctl.c if (IS_ERR(key_ref)) key_ref 603 security/keys/keyctl.c return PTR_ERR(key_ref); key_ref 617 security/keys/keyctl.c ret = key_move(key_ref_to_ptr(key_ref), key_ref_to_ptr(from_ref), key_ref 624 security/keys/keyctl.c key_ref_put(key_ref); key_ref 646 security/keys/keyctl.c key_ref_t key_ref; key_ref 651 security/keys/keyctl.c key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, KEY_NEED_VIEW); key_ref 652 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 655 security/keys/keyctl.c if (PTR_ERR(key_ref) == -EACCES) { key_ref 659 security/keys/keyctl.c key_ref = lookup_user_key(keyid, key_ref 662 security/keys/keyctl.c if (!IS_ERR(key_ref)) key_ref 667 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 672 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 698 security/keys/keyctl.c key_ref_put(key_ref); key_ref 719 security/keys/keyctl.c key_ref_t keyring_ref, key_ref, dest_ref; key_ref 760 security/keys/keyctl.c key_ref = keyring_search(keyring_ref, ktype, description, true); key_ref 761 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 762 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 772 security/keys/keyctl.c ret = key_permission(key_ref, KEY_NEED_LINK); key_ref 776 security/keys/keyctl.c ret = key_link(key_ref_to_ptr(dest_ref), key_ref_to_ptr(key_ref)); key_ref 781 security/keys/keyctl.c ret = key_ref_to_ptr(key_ref)->serial; key_ref 784 security/keys/keyctl.c key_ref_put(key_ref); key_ref 825 security/keys/keyctl.c key_ref_t key_ref; key_ref 831 security/keys/keyctl.c key_ref = lookup_user_key(keyid, 0, 0); key_ref 832 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 837 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 844 security/keys/keyctl.c ret = key_permission(key_ref, KEY_NEED_READ); key_ref 854 security/keys/keyctl.c if (!is_key_possessed(key_ref)) { key_ref 950 security/keys/keyctl.c key_ref_t key_ref; key_ref 967 security/keys/keyctl.c key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, key_ref 969 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 970 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 974 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 1066 security/keys/keyctl.c key_ref_t key_ref; key_ref 1073 security/keys/keyctl.c key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, key_ref 1075 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 1076 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 1080 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 1450 security/keys/keyctl.c key_ref_t key_ref; key_ref 1453 security/keys/keyctl.c key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, key_ref 1455 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 1458 security/keys/keyctl.c if (PTR_ERR(key_ref) == -EACCES) { key_ref 1462 security/keys/keyctl.c key_ref = lookup_user_key(id, key_ref 1465 security/keys/keyctl.c if (!IS_ERR(key_ref)) key_ref 1470 security/keys/keyctl.c ret = PTR_ERR(key_ref); key_ref 1475 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 1554 security/keys/keyctl.c key_ref_t key_ref; key_ref 1558 security/keys/keyctl.c key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, KEY_NEED_VIEW); key_ref 1559 security/keys/keyctl.c if (IS_ERR(key_ref)) { key_ref 1560 security/keys/keyctl.c if (PTR_ERR(key_ref) != -EACCES) key_ref 1561 security/keys/keyctl.c return PTR_ERR(key_ref); key_ref 1570 security/keys/keyctl.c key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, 0); key_ref 1571 security/keys/keyctl.c if (IS_ERR(key_ref)) key_ref 1572 security/keys/keyctl.c return PTR_ERR(key_ref); key_ref 1575 security/keys/keyctl.c key = key_ref_to_ptr(key_ref); key_ref 1597 security/keys/keyctl.c key_ref_put(key_ref); key_ref 1719 security/keys/keyctl.c key_ref_t key_ref; key_ref 1724 security/keys/keyctl.c key_ref = lookup_user_key(id, 0, KEY_NEED_SETATTR); key_ref 1725 security/keys/keyctl.c if (IS_ERR(key_ref)) key_ref 1726 security/keys/keyctl.c return PTR_ERR(key_ref); key_ref 1747 security/keys/keyctl.c ret = keyring_restrict(key_ref, _type ? type : NULL, restriction); key_ref 1750 security/keys/keyctl.c key_ref_put(key_ref); key_ref 82 security/keys/keyctl_pkey.c key_ref_t key_ref; key_ref 98 security/keys/keyctl_pkey.c key_ref = lookup_user_key(id, 0, KEY_NEED_SEARCH); key_ref 99 security/keys/keyctl_pkey.c if (IS_ERR(key_ref)) key_ref 100 security/keys/keyctl_pkey.c return PTR_ERR(key_ref); key_ref 101 security/keys/keyctl_pkey.c params->key = key_ref_to_ptr(key_ref); key_ref 26 security/keys/permission.c int key_task_permission(const key_ref_t key_ref, const struct cred *cred, key_ref 33 security/keys/permission.c key = key_ref_to_ptr(key_ref); key_ref 64 security/keys/permission.c if (is_key_possessed(key_ref)) key_ref 73 security/keys/permission.c return security_key_permission(key_ref, cred, perm); key_ref 158 security/keys/proc.c key_ref_t key_ref, skey_ref; key_ref 175 security/keys/proc.c key_ref = make_key_ref(key, 0); key_ref 186 security/keys/proc.c key_ref = make_key_ref(key, 1); key_ref 191 security/keys/proc.c rc = key_task_permission(key_ref, ctx.cred, KEY_NEED_VIEW); key_ref 425 security/keys/process_keys.c key_ref_t key_ref, ret, err; key_ref 435 security/keys/process_keys.c key_ref = NULL; key_ref 441 security/keys/process_keys.c key_ref = keyring_search_rcu( key_ref 443 security/keys/process_keys.c if (!IS_ERR(key_ref)) key_ref 446 security/keys/process_keys.c switch (PTR_ERR(key_ref)) { key_ref 449 security/keys/process_keys.c ret = key_ref; key_ref 452 security/keys/process_keys.c err = key_ref; key_ref 459 security/keys/process_keys.c key_ref = keyring_search_rcu( key_ref 461 security/keys/process_keys.c if (!IS_ERR(key_ref)) key_ref 464 security/keys/process_keys.c switch (PTR_ERR(key_ref)) { key_ref 470 security/keys/process_keys.c ret = key_ref; key_ref 473 security/keys/process_keys.c err = key_ref; key_ref 480 security/keys/process_keys.c key_ref = keyring_search_rcu( key_ref 483 security/keys/process_keys.c if (!IS_ERR(key_ref)) key_ref 486 security/keys/process_keys.c switch (PTR_ERR(key_ref)) { key_ref 492 security/keys/process_keys.c ret = key_ref; key_ref 495 security/keys/process_keys.c err = key_ref; key_ref 501 security/keys/process_keys.c key_ref = keyring_search_rcu(make_key_ref(user_session, 1), key_ref 505 security/keys/process_keys.c if (!IS_ERR(key_ref)) key_ref 508 security/keys/process_keys.c switch (PTR_ERR(key_ref)) { key_ref 514 security/keys/process_keys.c ret = key_ref; key_ref 517 security/keys/process_keys.c err = key_ref; key_ref 523 security/keys/process_keys.c key_ref = ret ? ret : err; key_ref 526 security/keys/process_keys.c return key_ref; key_ref 542 security/keys/process_keys.c key_ref_t key_ref, ret = ERR_PTR(-EACCES), err; key_ref 544 security/keys/process_keys.c key_ref = search_cred_keyrings_rcu(ctx); key_ref 545 security/keys/process_keys.c if (!IS_ERR(key_ref)) key_ref 547 security/keys/process_keys.c err = key_ref; key_ref 564 security/keys/process_keys.c key_ref = search_cred_keyrings_rcu(ctx); key_ref 567 security/keys/process_keys.c if (!IS_ERR(key_ref)) key_ref 569 security/keys/process_keys.c ret = key_ref; key_ref 575 security/keys/process_keys.c key_ref = ERR_PTR(-ENOKEY); key_ref 577 security/keys/process_keys.c key_ref = ret; key_ref 579 security/keys/process_keys.c key_ref = err; key_ref 582 security/keys/process_keys.c return key_ref; key_ref 622 security/keys/process_keys.c key_ref_t key_ref, skey_ref; key_ref 627 security/keys/process_keys.c key_ref = ERR_PTR(-ENOKEY); key_ref 637 security/keys/process_keys.c key_ref = ERR_PTR(ret); key_ref 645 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 655 security/keys/process_keys.c key_ref = ERR_PTR(ret); key_ref 663 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 693 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 700 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 707 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 712 security/keys/process_keys.c key_ref = ERR_PTR(-EINVAL); key_ref 721 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 731 security/keys/process_keys.c key_ref = ERR_PTR(-EKEYREVOKED); key_ref 741 security/keys/process_keys.c key_ref = make_key_ref(key, 1); key_ref 745 security/keys/process_keys.c key_ref = ERR_PTR(-EINVAL); key_ref 751 security/keys/process_keys.c key_ref = ERR_CAST(key); key_ref 755 security/keys/process_keys.c key_ref = make_key_ref(key, 0); key_ref 768 security/keys/process_keys.c key_ref = skey_ref; key_ref 804 security/keys/process_keys.c ret = key_task_permission(key_ref, ctx.cred, perm); key_ref 812 security/keys/process_keys.c return key_ref; key_ref 815 security/keys/process_keys.c key_ref_put(key_ref); key_ref 816 security/keys/process_keys.c key_ref = ERR_PTR(ret); key_ref 375 security/keys/request_key.c key_ref_t key_ref; key_ref 415 security/keys/request_key.c key_ref = search_process_keyrings_rcu(ctx); key_ref 417 security/keys/request_key.c if (!IS_ERR(key_ref)) key_ref 436 security/keys/request_key.c key = key_ref_to_ptr(key_ref); key_ref 581 security/keys/request_key.c key_ref_t key_ref; key_ref 602 security/keys/request_key.c key_ref = search_process_keyrings_rcu(&ctx); key_ref 605 security/keys/request_key.c if (!IS_ERR(key_ref)) { key_ref 607 security/keys/request_key.c ret = key_task_permission(key_ref, current_cred(), key_ref 610 security/keys/request_key.c key_ref_put(key_ref); key_ref 616 security/keys/request_key.c key = key_ref_to_ptr(key_ref); key_ref 628 security/keys/request_key.c } else if (PTR_ERR(key_ref) != -EAGAIN) { key_ref 629 security/keys/request_key.c key = ERR_CAST(key_ref); key_ref 783 security/keys/request_key.c key_ref_t key_ref; key_ref 792 security/keys/request_key.c key_ref = search_process_keyrings_rcu(&ctx); key_ref 793 security/keys/request_key.c if (IS_ERR(key_ref)) { key_ref 794 security/keys/request_key.c key = ERR_CAST(key_ref); key_ref 795 security/keys/request_key.c if (PTR_ERR(key_ref) == -EAGAIN) key_ref 798 security/keys/request_key.c key = key_ref_to_ptr(key_ref); key_ref 2334 security/security.c int security_key_permission(key_ref_t key_ref, key_ref 2337 security/security.c return call_int_hook(key_permission, 0, key_ref, cred, perm); key_ref 6577 security/selinux/hooks.c static int selinux_key_permission(key_ref_t key_ref, key_ref 6593 security/selinux/hooks.c key = key_ref_to_ptr(key_ref); key_ref 4235 security/smack/smack_lsm.c static int smack_key_permission(key_ref_t key_ref, key_ref 4250 security/smack/smack_lsm.c keyp = key_ref_to_ptr(key_ref);