Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f8f5cf6 authored by David Howells's avatar David Howells Committed by Linus Torvalds
Browse files

KEYS: Make request key instantiate the per-user keyrings



Make request_key() instantiate the per-user keyrings so that it doesn't oops
if it needs to get hold of the user session keyring because there isn't a
session keyring in place.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Tested-by: default avatarSteve French <smfrench@gmail.com>
Tested-by: default avatarRutger Nijlunsing <rutger.nijlunsing@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3ad4f597
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ extern key_ref_t search_process_keyrings(struct key_type *type,

extern struct key *find_keyring_by_name(const char *name, bool skip_perm_check);

extern int install_user_keyrings(struct task_struct *tsk);
extern int install_thread_keyring(struct task_struct *tsk);
extern int install_process_keyring(struct task_struct *tsk);

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ struct key_user root_key_user = {
/*
 * install user and user session keyrings for a particular UID
 */
static int install_user_keyrings(struct task_struct *tsk)
int install_user_keyrings(struct task_struct *tsk)
{
	struct user_struct *user = tsk->user;
	struct key *uid_keyring, *session_keyring;
+4 −0
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@ static int call_sbin_request_key(struct key_construction *cons,

	kenter("{%d},{%d},%s", key->serial, authkey->serial, op);

	ret = install_user_keyrings(tsk);
	if (ret < 0)
		goto error_alloc;

	/* allocate a new session keyring */
	sprintf(desc, "_req.%u", key->serial);