net: net_namespace: Fix undefined member in key_remove_domain()

[ Upstream commit aed0826b0cf2e488900ab92193893e803d65c070 ]

The key_domain member in struct net only exists if we define CONFIG_KEYS.
So we should add the define when we used key_domain.

Fixes: 9b24261051 ("keys: Network namespace domain tag")
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Yajun Deng 2021-09-18 17:04:10 +08:00 committed by Greg Kroah-Hartman
parent fb4a58f519
commit a585e04e34

View File

@ -486,7 +486,9 @@ struct net *copy_net_ns(unsigned long flags,
if (rv < 0) {
put_userns:
#ifdef CONFIG_KEYS
key_remove_domain(net->key_domain);
#endif
put_user_ns(user_ns);
net_drop_ns(net);
dec_ucounts:
@ -618,7 +620,9 @@ static void cleanup_net(struct work_struct *work)
list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
list_del_init(&net->exit_list);
dec_net_namespaces(net->ucounts);
#ifdef CONFIG_KEYS
key_remove_domain(net->key_domain);
#endif
put_user_ns(net->user_ns);
net_drop_ns(net);
}