aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYajun Deng <yajun.deng@linux.dev>2021-09-18 17:04:10 +0800
committerDavid S. Miller <davem@davemloft.net>2021-09-19 12:43:04 +0100
commitaed0826b0cf2e488900ab92193893e803d65c070 (patch)
tree505d95bcbc13d94f7ad1bbbe0b31b27ac6162851
parentnet: dpaa2-mac: add support for more ethtool 10G link modes (diff)
downloadlinux-dev-aed0826b0cf2e488900ab92193893e803d65c070.tar.xz
linux-dev-aed0826b0cf2e488900ab92193893e803d65c070.zip
net: net_namespace: Fix undefined member in key_remove_domain()
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: 9b242610514f ("keys: Network namespace domain tag") Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/net_namespace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index a448a9b5bb2d..202fa5eacd0f 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -473,7 +473,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_free(net);
dec_ucounts:
@@ -605,7 +607,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_free(net);
}