mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
keys: Fix request_key() lack of Link perm check on found key
The request_key() syscall allows a process to gain access to the 'possessor' permits of any key that grants it Search permission by virtue of request_key() not checking whether a key it finds grants Link permission to the caller. Signed-off-by: David Howells <[email protected]>
This commit is contained in:
parent
45e0f30c30
commit
504b69eb3c
2 changed files with 14 additions and 0 deletions
|
|
@ -564,6 +564,16 @@ struct key *request_key_and_link(struct key_type *type,
|
|||
key_ref = search_process_keyrings(&ctx);
|
||||
|
||||
if (!IS_ERR(key_ref)) {
|
||||
if (dest_keyring) {
|
||||
ret = key_task_permission(key_ref, current_cred(),
|
||||
KEY_NEED_LINK);
|
||||
if (ret < 0) {
|
||||
key_ref_put(key_ref);
|
||||
key = ERR_PTR(ret);
|
||||
goto error_free;
|
||||
}
|
||||
}
|
||||
|
||||
key = key_ref_to_ptr(key_ref);
|
||||
if (dest_keyring) {
|
||||
ret = key_link(dest_keyring, key);
|
||||
|
|
|
|||
Loading…
Reference in a new issue