[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y2I8lIldVgo7f3Tc@salvia>
Date: Wed, 2 Nov 2022 10:47:00 +0100
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Chen Zhongjin <chenzhongjin@...wei.com>
Cc: linux-kernel@...r.kernel.org, netfilter-devel@...r.kernel.org,
coreteam@...filter.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, kadlec@...filter.org, fw@...len.de,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, ast@...nel.org, lorenzo@...nel.org,
john.fastabend@...il.com
Subject: Re: [PATCH net v2] netfilter: nf_nat: Fix possible memory leak in
nf_nat_init()
On Tue, Nov 01, 2022 at 07:52:52PM +0800, Chen Zhongjin wrote:
> In nf_nat_init(), register_nf_nat_bpf() can fail and return directly
> without any error handling.
> Then nf_nat_bysource will leak and registering of &nat_net_ops,
> &follow_master_nat and nf_nat_hook won't be reverted.
>
> This leaves wild ops in linkedlists and when another module tries to
> call register_pernet_operations() or nf_ct_helper_expectfn_register()
> it triggers page fault:
>
> BUG: unable to handle page fault for address: fffffbfff81b964c
> RIP: 0010:register_pernet_operations+0x1b9/0x5f0
> Call Trace:
> <TASK>
> register_pernet_subsys+0x29/0x40
> ebtables_init+0x58/0x1000 [ebtables]
> ...
>
> Fixes: 820dc0523e05 ("net: netfilter: move bpf_ct_set_nat_info kfunc in nf_nat_bpf.c")
> Signed-off-by: Chen Zhongjin <chenzhongjin@...wei.com>
> ---
> Also revert the operation for &follow_master_nat and nf_nat_hook,
> then slightly fix commit msg for it.
Applied, thanks
Powered by blists - more mailing lists