fib_rules: exit_net cleanup check added
authorVasily Averin <vvs@virtuozzo.com>
Sun, 12 Nov 2017 19:30:01 +0000 (22:30 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Nov 2017 06:45:53 +0000 (15:45 +0900)
Be sure that rules_ops list initialized in net_init hook was return
to initial state.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/fib_rules.c

index fafd0a41e3f79b9ee19da5bd008d0732b51771bc..98e1066c3d551df066fd7681f197718f75afb251 100644 (file)
@@ -1022,8 +1022,14 @@ static int __net_init fib_rules_net_init(struct net *net)
        return 0;
 }
 
+static void __net_exit fib_rules_net_exit(struct net *net)
+{
+       WARN_ON_ONCE(!list_empty(&net->rules_ops));
+}
+
 static struct pernet_operations fib_rules_net_ops = {
        .init = fib_rules_net_init,
+       .exit = fib_rules_net_exit,
 };
 
 static int __init fib_rules_init(void)