diff mbox series

[net-next] netns: restore ops before calling ops_exit_list

Message ID 1561029880-1666-1-git-send-email-lirongqing@baidu.com
State Accepted
Delegated to: David Miller
Headers show
Series [net-next] netns: restore ops before calling ops_exit_list | expand

Commit Message

Li RongQing June 20, 2019, 11:24 a.m. UTC
ops has been iterated to first element when call pre_exit, and
it needs to restore from save_ops, not save ops to save_ops

Fixes: d7d99872c144 ("netns: add pre_exit method to struct pernet_operations")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/core/net_namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet June 20, 2019, 11:27 a.m. UTC | #1
On Thu, Jun 20, 2019 at 7:24 AM Li RongQing <lirongqing@baidu.com> wrote:
>
> ops has been iterated to first element when call pre_exit, and
> it needs to restore from save_ops, not save ops to save_ops
>
> Fixes: d7d99872c144 ("netns: add pre_exit method to struct pernet_operations")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Thanks for fixing this :)

Reviewed-by: Eric Dumazet <edumazet@google.com>
David Miller June 22, 2019, 11:56 p.m. UTC | #2
From: Li RongQing <lirongqing@baidu.com>
Date: Thu, 20 Jun 2019 19:24:40 +0800

> ops has been iterated to first element when call pre_exit, and
> it needs to restore from save_ops, not save ops to save_ops
> 
> Fixes: d7d99872c144 ("netns: add pre_exit method to struct pernet_operations")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied, thank you.
diff mbox series

Patch

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 89dc99a28978..198ce503ae73 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -345,7 +345,7 @@  static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
 
 	synchronize_rcu();
 
-	saved_ops = ops;
+	ops = saved_ops;
 	list_for_each_entry_continue_reverse(ops, &pernet_list, list)
 		ops_exit_list(ops, &net_exit_list);