[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vgfnpdvwiji7bbg7yb5fbymp6f6q5f66rywkjyrxtdejdgoi37@ghpon5czjtkm>
Date: Wed, 10 Sep 2025 17:57:52 +0200
From: Jan Kara <jack@...e.cz>
To: Christian Brauner <brauner@...nel.org>
Cc: Jan Kara <jack@...e.cz>, Amir Goldstein <amir73il@...il.com>,
linux-fsdevel@...r.kernel.org, Josef Bacik <josef@...icpanda.com>,
Jeff Layton <jlayton@...nel.org>, Mike Yuan <me@...dnzj.com>,
Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>, Lennart Poettering <mzxreary@...inter.de>,
Daan De Meyer <daan.j.demeyer@...il.com>, Aleksa Sarai <cyphar@...har.com>,
Alexander Viro <viro@...iv.linux.org.uk>, Jens Axboe <axboe@...nel.dk>, Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>, Michal Koutný <mkoutny@...e.com>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Chuck Lever <chuck.lever@...cle.com>, linux-nfs@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 14/32] net: use ns_common_init()
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@...nel.org>
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@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists