fib_notifier: exit_net cleanup check added
authorVasily Averin <vvs@virtuozzo.com>
Sun, 12 Nov 2017 19:29:33 +0000 (22:29 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Nov 2017 06:45:53 +0000 (15:45 +0900)
Be sure that fib_notifier_ops list initilized 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_notifier.c

index 4fc202dbdfb607c6042c2de12b71b4a3b1fa2fef..6b8cd494574fb0908ea0a37659b75486706289c2 100644 (file)
@@ -161,8 +161,14 @@ static int __net_init fib_notifier_net_init(struct net *net)
        return 0;
 }
 
+static void __net_exit fib_notifier_net_exit(struct net *net)
+{
+       WARN_ON_ONCE(!list_empty(&net->fib_notifier_ops));
+}
+
 static struct pernet_operations fib_notifier_net_ops = {
        .init = fib_notifier_net_init,
+       .exit = fib_notifier_net_exit,
 };
 
 static int __init fib_notifier_init(void)