linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain()
@ 2021-09-18  9:04 Yajun Deng
  2021-09-19 11:50 ` patchwork-bot+netdevbpf
  2021-09-19 23:25 ` Cong Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Yajun Deng @ 2021-09-18  9:04 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, Yajun Deng

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(+)

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain()
  2021-09-18  9:04 [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain() Yajun Deng
@ 2021-09-19 11:50 ` patchwork-bot+netdevbpf
  2021-09-19 23:25 ` Cong Wang
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-19 11:50 UTC (permalink / raw)
  To: Yajun Deng; +Cc: davem, kuba, netdev, linux-kernel

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain()
  2021-09-18  9:04 [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain() Yajun Deng
  2021-09-19 11:50 ` patchwork-bot+netdevbpf
@ 2021-09-19 23:25 ` Cong Wang
  2021-09-20 12:29   ` yajun.deng
  1 sibling, 1 reply; 4+ messages in thread
From: Cong Wang @ 2021-09-19 23:25 UTC (permalink / raw)
  To: Yajun Deng
  Cc: David Miller, Jakub Kicinski, Linux Kernel Network Developers, LKML

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain()
  2021-09-19 23:25 ` Cong Wang
@ 2021-09-20 12:29   ` yajun.deng
  0 siblings, 0 replies; 4+ messages in thread
From: yajun.deng @ 2021-09-20 12:29 UTC (permalink / raw)
  To: Cong Wang; +Cc: davem, kuba, netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-20 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18  9:04 [PATCH net-next] net: net_namespace: Fix undefined member in key_remove_domain() Yajun Deng
2021-09-19 11:50 ` patchwork-bot+netdevbpf
2021-09-19 23:25 ` Cong Wang
2021-09-20 12:29   ` yajun.deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).