Re: [PATCH 14/32] net: use ns_common_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 10-09-25 16:36:59, Christian Brauner wrote:
> Don't cargo-cult the same thing over and over.
> 
> Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>

One comment below.

> @@ -812,17 +828,14 @@ static void net_ns_net_debugfs(struct net *net)
>  
>  static __net_init int net_ns_net_init(struct net *net)
>  {
> -#ifdef CONFIG_NET_NS
> -	net->ns.ops = &netns_operations;
> -#endif
> -	net->ns.inum = PROC_NET_INIT_INO;
> -	if (net != &init_net) {
> -		int ret = ns_alloc_inum(&net->ns);
> -		if (ret)
> -			return ret;
> -	}
> +	int ret = 0;
> +
> +	if (net == &init_net)
> +		net->ns.inum = PROC_NET_INIT_INO;
> +	else
> +		ret = proc_alloc_inum(&to_ns_common(net)->inum);
>  	net_ns_net_debugfs(net);

Here you're calling net_ns_net_debugfs() even if proc_alloc_inum() failed
which looks like a bug to me...

								Honza

> -	return 0;
> +	return ret;
>  }
>  
>  static __net_exit void net_ns_net_exit(struct net *net)
> @@ -1282,7 +1295,12 @@ void __init net_ns_init(void)
>  #ifdef CONFIG_KEYS
>  	init_net.key_domain = &init_net_key_domain;
>  #endif
> -	preinit_net(&init_net, &init_user_ns);
> +	/*
> +	 * This currently cannot fail as the initial network namespace
> +	 * has a static inode number.
> +	 */
> +	if (preinit_net(&init_net, &init_user_ns))
> +		panic("Could not preinitialize the initial network namespace");
>  
>  	down_write(&pernet_ops_rwsem);
>  	if (setup_net(&init_net))
> 
> -- 
> 2.47.3
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux