diff options
author | Florian Westphal <fw@strlen.de> | 2018-06-11 13:20:36 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-06-12 19:28:18 +0200 |
commit | 0a2cf5ee432c2e8718af3553a56a3760d767b736 (patch) | |
tree | 2d1f23b1be2546c3b5ee5511f74e469123f40b65 /net/ipv4/tcp.c | |
parent | netfilter: nf_tables: fix module unload race (diff) | |
download | linux-0a2cf5ee432c2e8718af3553a56a3760d767b736.tar.xz linux-0a2cf5ee432c2e8718af3553a56a3760d767b736.zip |
netfilter: nf_tables: close race between netns exit and rmmod
If net namespace is exiting while nf_tables module is being removed
we can oops:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000040
IP: nf_tables_flowtable_event+0x43/0xf0 [nf_tables]
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
Modules linked in: nf_tables(-) nfnetlink [..]
unregister_netdevice_notifier+0xdd/0x130
nf_tables_module_exit+0x24/0x3a [nf_tables]
SyS_delete_module+0x1c5/0x240
do_syscall_64+0x74/0x190
Avoid this by attempting to take reference on the net namespace from
the notifiers. If it fails the namespace is exiting already, and nft
core is taking care of cleanup work.
We also need to make sure the netdev hook type gets removed
before netns ops removal, else notifier might be invoked with device
event for a netns where net->nft was never initialised (because
pernet ops was removed beforehand).
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/tcp.c')
0 files changed, 0 insertions, 0 deletions