[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201214194101.789109bd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 14 Dec 2020 19:41:01 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Yonatan Linik <yonatanlinik@...il.com>
Cc: davem@...emloft.net, ast@...nel.org, daniel@...earbox.net,
kafai@...com, songliubraving@...com, yhs@...com, andriin@...com,
john.fastabend@...il.com, kpsingh@...omium.org, willemb@...gle.com,
john.ogness@...utronix.de, arnd@...db.de, maowenan@...wei.com,
colin.king@...onical.com, orcohen@...oaltonetworks.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org
Subject: Re: [PATCH v2 1/1] net: Fix use of proc_fs
On Mon, 14 Dec 2020 22:25:50 +0200 Yonatan Linik wrote:
> proc_fs was used, in af_packet, without a surrounding #ifdef,
> although there is no hard dependency on proc_fs.
> That caused the initialization of the af_packet module to fail
> when CONFIG_PROC_FS=n.
>
> Specifically, proc_create_net() was used in af_packet.c,
> and when it fails, packet_net_init() returns -ENOMEM.
> It will always fail when the kernel is compiled without proc_fs,
> because, proc_create_net() for example always returns NULL.
>
> The calling order that starts in af_packet.c is as follows:
> packet_init()
> register_pernet_subsys()
> register_pernet_operations()
> __register_pernet_operations()
> ops_init()
> ops->init() (packet_net_ops.init=packet_net_init())
> proc_create_net()
>
> It worked in the past because register_pernet_subsys()'s return value
> wasn't checked before this Commit 36096f2f4fa0 ("packet: Fix error path in
> packet_init.").
> It always returned an error, but was not checked before, so everything
> was working even when CONFIG_PROC_FS=n.
>
> The fix here is simply to add the necessary #ifdef.
>
> This also fixes a similar error in tls_proc.c, that was found by Jakub
> Kicinski.
>
> Signed-off-by: Yonatan Linik <yonatanlinik@...il.com>
Applied, and queued for stable, thanks!
Powered by blists - more mailing lists