Code: static int __init sit_init(void)
{
	int err;
 
 	printk(KERN_INFO "IPv6 over IPv4 tunneling driver\n");
 
	if (xfrm4_tunnel_register(&sit_handler, AF_INET6) < 0) {
		printk(KERN_INFO "sit init: Can't add protocol\n");
		return -EAGAIN;
	}
 	err = register_pernet_device(&sit_net_ops);
 	if (err < 0)
		xfrm4_tunnel_deregister(&sit_handler, AF_INET6);
 	return err;
 }

Commit Message: tunnels: fix netns vs proto registration ordering

Same stuff as in ip_gre patch: receive hook can be called before netns
setup is done, oopsing in net_generic().

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
CWE ID: CWE-362
static int __init sit_init(void)
{
	int err;
 
 	printk(KERN_INFO "IPv6 over IPv4 tunneling driver\n");
 
 	err = register_pernet_device(&sit_net_ops);
 	if (err < 0)
		return err;
	err = xfrm4_tunnel_register(&sit_handler, AF_INET6);
	if (err < 0) {
		unregister_pernet_device(&sit_net_ops);
		printk(KERN_INFO "sit init: Can't add protocol\n");
	}
 	return err;
 }
