All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv6: fix WARNING in ip6_route_net_exit_late()
@ 2022-11-02  2:06 Zhengchao Shao
  2022-11-02  3:21 ` Eric Dumazet
  2022-11-03  4:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Zhengchao Shao @ 2022-11-02  2:06 UTC (permalink / raw)
  To: netdev, davem, yoshfuji, dsahern, edumazet, kuba, pabeni
  Cc: dlezcano, benjamin.thery, weiyongjun1, yuehaibing, shaozhengchao

During the initialization of ip6_route_net_init_late(), if file
ipv6_route or rt6_stats fails to be created, the initialization is
successful by default. Therefore, the ipv6_route or rt6_stats file
doesn't be found during the remove in ip6_route_net_exit_late(). It
will cause WRNING.

The following is the stack information:
name 'rt6_stats'
WARNING: CPU: 0 PID: 9 at fs/proc/generic.c:712 remove_proc_entry+0x389/0x460
Modules linked in:
Workqueue: netns cleanup_net
RIP: 0010:remove_proc_entry+0x389/0x460
PKRU: 55555554
Call Trace:
<TASK>
ops_exit_list+0xb0/0x170
cleanup_net+0x4ea/0xb00
process_one_work+0x9bf/0x1710
worker_thread+0x665/0x1080
kthread+0x2e4/0x3a0
ret_from_fork+0x1f/0x30
</TASK>

Fixes: cdb1876192db ("[NETNS][IPV6] route6 - create route6 proc files for the namespace")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 net/ipv6/route.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 69252eb462b2..2f355f0ec32a 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6555,10 +6555,16 @@ static void __net_exit ip6_route_net_exit(struct net *net)
 static int __net_init ip6_route_net_init_late(struct net *net)
 {
 #ifdef CONFIG_PROC_FS
-	proc_create_net("ipv6_route", 0, net->proc_net, &ipv6_route_seq_ops,
-			sizeof(struct ipv6_route_iter));
-	proc_create_net_single("rt6_stats", 0444, net->proc_net,
-			rt6_stats_seq_show, NULL);
+	if (!proc_create_net("ipv6_route", 0, net->proc_net,
+			     &ipv6_route_seq_ops,
+			     sizeof(struct ipv6_route_iter)))
+		return -ENOMEM;
+
+	if (!proc_create_net_single("rt6_stats", 0444, net->proc_net,
+				    rt6_stats_seq_show, NULL)) {
+		remove_proc_entry("ipv6_route", net->proc_net);
+		return -ENOMEM;
+	}
 #endif
 	return 0;
 }
-- 
2.17.1


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

* Re: [PATCH net] ipv6: fix WARNING in ip6_route_net_exit_late()
  2022-11-02  2:06 [PATCH net] ipv6: fix WARNING in ip6_route_net_exit_late() Zhengchao Shao
@ 2022-11-02  3:21 ` Eric Dumazet
  2022-11-03  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2022-11-02  3:21 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, davem, yoshfuji, dsahern, kuba, pabeni, dlezcano,
	benjamin.thery, weiyongjun1, yuehaibing

On Tue, Nov 1, 2022 at 6:59 PM Zhengchao Shao <shaozhengchao@huawei.com> wrote:
>
> During the initialization of ip6_route_net_init_late(), if file
> ipv6_route or rt6_stats fails to be created, the initialization is
> successful by default. Therefore, the ipv6_route or rt6_stats file
> doesn't be found during the remove in ip6_route_net_exit_late(). It
> will cause WRNING.

>
> Fixes: cdb1876192db ("[NETNS][IPV6] route6 - create route6 proc files for the namespace")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>  net/ipv6/route.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>

SGTM, thanks.

Reviewed-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net] ipv6: fix WARNING in ip6_route_net_exit_late()
  2022-11-02  2:06 [PATCH net] ipv6: fix WARNING in ip6_route_net_exit_late() Zhengchao Shao
  2022-11-02  3:21 ` Eric Dumazet
@ 2022-11-03  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-03  4:00 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, davem, yoshfuji, dsahern, edumazet, kuba, pabeni,
	dlezcano, benjamin.thery, weiyongjun1, yuehaibing

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 2 Nov 2022 10:06:10 +0800 you wrote:
> During the initialization of ip6_route_net_init_late(), if file
> ipv6_route or rt6_stats fails to be created, the initialization is
> successful by default. Therefore, the ipv6_route or rt6_stats file
> doesn't be found during the remove in ip6_route_net_exit_late(). It
> will cause WRNING.
> 
> The following is the stack information:
> name 'rt6_stats'
> WARNING: CPU: 0 PID: 9 at fs/proc/generic.c:712 remove_proc_entry+0x389/0x460
> Modules linked in:
> Workqueue: netns cleanup_net
> RIP: 0010:remove_proc_entry+0x389/0x460
> PKRU: 55555554
> Call Trace:
> <TASK>
> ops_exit_list+0xb0/0x170
> cleanup_net+0x4ea/0xb00
> process_one_work+0x9bf/0x1710
> worker_thread+0x665/0x1080
> kthread+0x2e4/0x3a0
> ret_from_fork+0x1f/0x30
> </TASK>
> 
> [...]

Here is the summary with links:
  - [net] ipv6: fix WARNING in ip6_route_net_exit_late()
    https://git.kernel.org/netdev/net/c/768b3c745fe5

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] 3+ messages in thread

end of thread, other threads:[~2022-11-03  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02  2:06 [PATCH net] ipv6: fix WARNING in ip6_route_net_exit_late() Zhengchao Shao
2022-11-02  3:21 ` Eric Dumazet
2022-11-03  4:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.