mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	net/net_namespace: Check the return value of register_pernet_subsys()
In net_ns_init(), register_pernet_subsys() could fail while registering network namespace subsystems. The fix checks the return value and sends a panic() on failure. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									89dfd00837
								
							
						
					
					
						commit
						0eb987c874
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -917,7 +917,8 @@ static int __init net_ns_init(void)
 | 
			
		|||
	init_net_initialized = true;
 | 
			
		||||
	up_write(&pernet_ops_rwsem);
 | 
			
		||||
 | 
			
		||||
	register_pernet_subsys(&net_ns_ops);
 | 
			
		||||
	if (register_pernet_subsys(&net_ns_ops))
 | 
			
		||||
		panic("Could not register network namespace subsystems");
 | 
			
		||||
 | 
			
		||||
	rtnl_register(PF_UNSPEC, RTM_NEWNSID, rtnl_net_newid, NULL,
 | 
			
		||||
		      RTNL_FLAG_DOIT_UNLOCKED);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue