diff mbox series

[net-next] net: net_namespace: Fix undefined member in key_remove_domain()

Message ID 20210918090410.29772-1-yajun.deng@linux.dev (mailing list archive)
State Accepted
Commit aed0826b0cf2e488900ab92193893e803d65c070
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: net_namespace: Fix undefined member in key_remove_domain() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: dhowells@redhat.com; 4 maintainers not CCed: changbin.du@intel.com daniel@iogearbox.net dhowells@redhat.com edumazet@google.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Yajun Deng Sept. 18, 2021, 9:04 a.m. UTC
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>
---
 net/core/net_namespace.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org Sept. 19, 2021, 11:50 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sat, 18 Sep 2021 17:04:10 +0800 you wrote:
> 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>
> ---
>  net/core/net_namespace.c | 4 ++++
>  1 file changed, 4 insertions(+)

Here is the summary with links:
  - [net-next] net: net_namespace: Fix undefined member in key_remove_domain()
    https://git.kernel.org/netdev/net-next/c/aed0826b0cf2

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Cong Wang Sept. 19, 2021, 11:25 p.m. UTC | #2
On Sat, Sep 18, 2021 at 7:28 AM Yajun Deng <yajun.deng@linux.dev> wrote:
>
> 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.

But key_remove_domain() is just a nop if !CONFIG_KEYS:

#else /* CONFIG_KEYS */
...
#define key_remove_domain(d)            do { } while(0)

So what exactly are you fixing?

Thanks.
Yajun Deng Sept. 20, 2021, 12:29 p.m. UTC | #3
From: Cong Wang
Date: 2021-09-20 07:25
To: Yajun Deng
CC: David Miller; Jakub Kicinski; Linux Kernel Network Developers; LKML
Subject: Re: [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain()
On Sat, Sep 18, 2021 at 7:28 AM Yajun Deng <yajun.deng@linux.dev> wrote:
>
> 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.
 
But key_remove_domain() is just a nop if !CONFIG_KEYS:
 
#else /* CONFIG_KEYS */
...
#define key_remove_domain(d)            do { } while(0) 

Yes, you're right.
 
So what exactly are you fixing?
 
Thanks.
diff mbox series

Patch

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);
 	}