Lines Matching refs:key_ref

80 	key_ref_t keyring_ref, key_ref;  in SYSCALL_DEFINE5()  local
134 key_ref = key_create_or_update(keyring_ref, type, description, in SYSCALL_DEFINE5()
137 if (!IS_ERR(key_ref)) { in SYSCALL_DEFINE5()
138 ret = key_ref_to_ptr(key_ref)->serial; in SYSCALL_DEFINE5()
139 key_ref_put(key_ref); in SYSCALL_DEFINE5()
142 ret = PTR_ERR(key_ref); in SYSCALL_DEFINE5()
260 key_ref_t key_ref; in keyctl_get_keyring_ID() local
265 key_ref = lookup_user_key(id, lflags, KEY_NEED_SEARCH); in keyctl_get_keyring_ID()
266 if (IS_ERR(key_ref)) { in keyctl_get_keyring_ID()
267 ret = PTR_ERR(key_ref); in keyctl_get_keyring_ID()
271 ret = key_ref_to_ptr(key_ref)->serial; in keyctl_get_keyring_ID()
272 key_ref_put(key_ref); in keyctl_get_keyring_ID()
329 key_ref_t key_ref; in keyctl_update_key() local
351 key_ref = lookup_user_key(id, 0, KEY_NEED_WRITE); in keyctl_update_key()
352 if (IS_ERR(key_ref)) { in keyctl_update_key()
353 ret = PTR_ERR(key_ref); in keyctl_update_key()
358 ret = key_update(key_ref, payload, plen); in keyctl_update_key()
360 key_ref_put(key_ref); in keyctl_update_key()
381 key_ref_t key_ref; in keyctl_revoke_key() local
385 key_ref = lookup_user_key(id, 0, KEY_NEED_WRITE); in keyctl_revoke_key()
386 if (IS_ERR(key_ref)) { in keyctl_revoke_key()
387 ret = PTR_ERR(key_ref); in keyctl_revoke_key()
390 key_ref = lookup_user_key(id, 0, KEY_NEED_SETATTR); in keyctl_revoke_key()
391 if (IS_ERR(key_ref)) { in keyctl_revoke_key()
392 ret = PTR_ERR(key_ref); in keyctl_revoke_key()
397 key = key_ref_to_ptr(key_ref); in keyctl_revoke_key()
404 key_ref_put(key_ref); in keyctl_revoke_key()
422 key_ref_t key_ref; in keyctl_invalidate_key() local
428 key_ref = lookup_user_key(id, 0, KEY_NEED_SEARCH); in keyctl_invalidate_key()
429 if (IS_ERR(key_ref)) { in keyctl_invalidate_key()
430 ret = PTR_ERR(key_ref); in keyctl_invalidate_key()
434 key_ref = lookup_user_key(id, 0, KEY_SYSADMIN_OVERRIDE); in keyctl_invalidate_key()
435 if (IS_ERR(key_ref)) in keyctl_invalidate_key()
438 &key_ref_to_ptr(key_ref)->flags)) in keyctl_invalidate_key()
447 key = key_ref_to_ptr(key_ref); in keyctl_invalidate_key()
454 key_ref_put(key_ref); in keyctl_invalidate_key()
517 key_ref_t keyring_ref, key_ref; in keyctl_keyring_link() local
526 key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); in keyctl_keyring_link()
527 if (IS_ERR(key_ref)) { in keyctl_keyring_link()
528 ret = PTR_ERR(key_ref); in keyctl_keyring_link()
532 ret = key_link(key_ref_to_ptr(keyring_ref), key_ref_to_ptr(key_ref)); in keyctl_keyring_link()
534 key_ref_put(key_ref); in keyctl_keyring_link()
554 key_ref_t keyring_ref, key_ref; in keyctl_keyring_unlink() local
564 key_ref = lookup_user_key(id, KEY_LOOKUP_PARTIAL, KEY_NEED_UNLINK); in keyctl_keyring_unlink()
565 if (IS_ERR(key_ref)) { in keyctl_keyring_unlink()
566 ret = PTR_ERR(key_ref); in keyctl_keyring_unlink()
571 key = key_ref_to_ptr(key_ref); in keyctl_keyring_unlink()
578 key_ref_put(key_ref); in keyctl_keyring_unlink()
598 key_ref_t key_ref, from_ref, to_ref; in keyctl_keyring_move() local
604 key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); in keyctl_keyring_move()
605 if (IS_ERR(key_ref)) in keyctl_keyring_move()
606 return PTR_ERR(key_ref); in keyctl_keyring_move()
620 ret = key_move(key_ref_to_ptr(key_ref), key_ref_to_ptr(from_ref), in keyctl_keyring_move()
627 key_ref_put(key_ref); in keyctl_keyring_move()
649 key_ref_t key_ref; in keyctl_describe_key() local
654 key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, KEY_NEED_VIEW); in keyctl_describe_key()
655 if (IS_ERR(key_ref)) { in keyctl_describe_key()
658 if (PTR_ERR(key_ref) == -EACCES) { in keyctl_describe_key()
662 key_ref = lookup_user_key(keyid, in keyctl_describe_key()
665 if (!IS_ERR(key_ref)) in keyctl_describe_key()
670 ret = PTR_ERR(key_ref); in keyctl_describe_key()
675 key = key_ref_to_ptr(key_ref); in keyctl_describe_key()
701 key_ref_put(key_ref); in keyctl_describe_key()
722 key_ref_t keyring_ref, key_ref, dest_ref; in keyctl_keyring_search() local
763 key_ref = keyring_search(keyring_ref, ktype, description, true); in keyctl_keyring_search()
764 if (IS_ERR(key_ref)) { in keyctl_keyring_search()
765 ret = PTR_ERR(key_ref); in keyctl_keyring_search()
775 ret = key_permission(key_ref, KEY_NEED_LINK); in keyctl_keyring_search()
779 ret = key_link(key_ref_to_ptr(dest_ref), key_ref_to_ptr(key_ref)); in keyctl_keyring_search()
784 ret = key_ref_to_ptr(key_ref)->serial; in keyctl_keyring_search()
787 key_ref_put(key_ref); in keyctl_keyring_search()
828 key_ref_t key_ref; in keyctl_read_key() local
834 key_ref = lookup_user_key(keyid, 0, KEY_DEFER_PERM_CHECK); in keyctl_read_key()
835 if (IS_ERR(key_ref)) { in keyctl_read_key()
840 key = key_ref_to_ptr(key_ref); in keyctl_read_key()
847 ret = key_permission(key_ref, KEY_NEED_READ); in keyctl_read_key()
857 if (!is_key_possessed(key_ref)) { in keyctl_read_key()
953 key_ref_t key_ref; in keyctl_chown_key() local
971 key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, in keyctl_chown_key()
973 if (IS_ERR(key_ref)) { in keyctl_chown_key()
974 ret = PTR_ERR(key_ref); in keyctl_chown_key()
978 key = key_ref_to_ptr(key_ref); in keyctl_chown_key()
1076 key_ref_t key_ref; in keyctl_setperm_key() local
1083 key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, in keyctl_setperm_key()
1085 if (IS_ERR(key_ref)) { in keyctl_setperm_key()
1086 ret = PTR_ERR(key_ref); in keyctl_setperm_key()
1090 key = key_ref_to_ptr(key_ref); in keyctl_setperm_key()
1460 key_ref_t key_ref; in keyctl_set_timeout() local
1463 key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, in keyctl_set_timeout()
1465 if (IS_ERR(key_ref)) { in keyctl_set_timeout()
1468 if (PTR_ERR(key_ref) == -EACCES) { in keyctl_set_timeout()
1472 key_ref = lookup_user_key(id, in keyctl_set_timeout()
1475 if (!IS_ERR(key_ref)) in keyctl_set_timeout()
1480 ret = PTR_ERR(key_ref); in keyctl_set_timeout()
1485 key = key_ref_to_ptr(key_ref); in keyctl_set_timeout()
1566 key_ref_t key_ref; in keyctl_get_security() local
1570 key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, KEY_NEED_VIEW); in keyctl_get_security()
1571 if (IS_ERR(key_ref)) { in keyctl_get_security()
1572 if (PTR_ERR(key_ref) != -EACCES) in keyctl_get_security()
1573 return PTR_ERR(key_ref); in keyctl_get_security()
1582 key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, in keyctl_get_security()
1584 if (IS_ERR(key_ref)) in keyctl_get_security()
1585 return PTR_ERR(key_ref); in keyctl_get_security()
1588 key = key_ref_to_ptr(key_ref); in keyctl_get_security()
1610 key_ref_put(key_ref); in keyctl_get_security()
1732 key_ref_t key_ref; in keyctl_restrict_keyring() local
1737 key_ref = lookup_user_key(id, 0, KEY_NEED_SETATTR); in keyctl_restrict_keyring()
1738 if (IS_ERR(key_ref)) in keyctl_restrict_keyring()
1739 return PTR_ERR(key_ref); in keyctl_restrict_keyring()
1760 ret = keyring_restrict(key_ref, _type ? type : NULL, restriction); in keyctl_restrict_keyring()
1763 key_ref_put(key_ref); in keyctl_restrict_keyring()
1779 key_ref_t key_ref; in keyctl_watch_key() local
1785 key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_VIEW); in keyctl_watch_key()
1786 if (IS_ERR(key_ref)) in keyctl_watch_key()
1787 return PTR_ERR(key_ref); in keyctl_watch_key()
1788 key = key_ref_to_ptr(key_ref); in keyctl_watch_key()