umh: creds: kill subprocess_info->cred logic
Now that nobody ever changes subprocess_info->cred we can kill this member and related code. ____call_usermodehelper() always runs in the context of freshly forked kernel thread, it has the proper ->cred copied from its parent kthread, keventd. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
685bfd2c48
commit
c70a626d3e
@@ -346,66 +346,6 @@ struct cred *prepare_exec_creds(void)
|
||||
return new;
|
||||
}
|
||||
|
||||
/*
|
||||
* prepare new credentials for the usermode helper dispatcher
|
||||
*/
|
||||
struct cred *prepare_usermodehelper_creds(void)
|
||||
{
|
||||
#ifdef CONFIG_KEYS
|
||||
struct thread_group_cred *tgcred = NULL;
|
||||
#endif
|
||||
struct cred *new;
|
||||
|
||||
#ifdef CONFIG_KEYS
|
||||
tgcred = kzalloc(sizeof(*new->tgcred), GFP_ATOMIC);
|
||||
if (!tgcred)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
new = kmem_cache_alloc(cred_jar, GFP_ATOMIC);
|
||||
if (!new)
|
||||
goto free_tgcred;
|
||||
|
||||
kdebug("prepare_usermodehelper_creds() alloc %p", new);
|
||||
|
||||
memcpy(new, &init_cred, sizeof(struct cred));
|
||||
|
||||
atomic_set(&new->usage, 1);
|
||||
set_cred_subscribers(new, 0);
|
||||
get_group_info(new->group_info);
|
||||
get_uid(new->user);
|
||||
|
||||
#ifdef CONFIG_KEYS
|
||||
new->thread_keyring = NULL;
|
||||
new->request_key_auth = NULL;
|
||||
new->jit_keyring = KEY_REQKEY_DEFL_DEFAULT;
|
||||
|
||||
atomic_set(&tgcred->usage, 1);
|
||||
spin_lock_init(&tgcred->lock);
|
||||
new->tgcred = tgcred;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SECURITY
|
||||
new->security = NULL;
|
||||
#endif
|
||||
if (security_prepare_creds(new, &init_cred, GFP_ATOMIC) < 0)
|
||||
goto error;
|
||||
validate_creds(new);
|
||||
|
||||
BUG_ON(atomic_read(&new->usage) != 1);
|
||||
return new;
|
||||
|
||||
error:
|
||||
put_cred(new);
|
||||
return NULL;
|
||||
|
||||
free_tgcred:
|
||||
#ifdef CONFIG_KEYS
|
||||
kfree(tgcred);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy credentials for the new process created by fork()
|
||||
*
|
||||
|
Reference in New Issue
Block a user