mirror of
https://github.com/torvalds/linux.git
synced 2026-10-25 08:16:03 +01:00
userns: remove dead key_put() on the create_user_ns() error path
create_user_ns() jumps to fail_keyring when setup_userns_sysctls() fails. At that point ns was freshly allocated with kmem_cache_zalloc() and ns->persistent_keyring_register is only ever assigned later, lazily, from key_get_persistent() (security/keys/persistent.c). The key_put() therefore always receives NULL. Remove the dead call. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Link: https://patch.msgid.link/20260828091659.358700-2-cui.tao@linux.dev Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Bradley Morgan <brads@mainlining.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
cee9395acd
commit
fec2c3c074
|
|
@ -162,9 +162,6 @@ int create_user_ns(struct cred *new)
|
|||
ns_tree_add(ns);
|
||||
return 0;
|
||||
fail_keyring:
|
||||
#ifdef CONFIG_PERSISTENT_KEYRINGS
|
||||
key_put(ns->persistent_keyring_register);
|
||||
#endif
|
||||
ns_common_free(ns);
|
||||
fail_free:
|
||||
kmem_cache_free(user_ns_cachep, ns);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user