RDS: TCP: unregister_netdevice_notifier() in error path of rds_tcp_init_net
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Thu, 1 Dec 2016 12:44:43 +0000 (04:44 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Dec 2016 18:29:26 +0000 (13:29 -0500)
If some error is encountered in rds_tcp_init_net, make sure to
unregister_netdevice_notifier(), else we could trigger a panic
later on, when the modprobe from a netns fails.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/tcp.c

index fcddacc92e018bee041f250cde5e48ba8ea70c6a..20e2923dc827fdc447082159bffe34d39caeca51 100644 (file)
@@ -659,6 +659,8 @@ out_recv:
 out_pernet:
        unregister_pernet_subsys(&rds_tcp_net_ops);
 out_slab:
+       if (unregister_netdevice_notifier(&rds_tcp_dev_notifier))
+               pr_warn("could not unregister rds_tcp_dev_notifier\n");
        kmem_cache_destroy(rds_tcp_conn_slab);
 out:
        return ret;