diff options
author | Florian Westphal <fw@strlen.de> | 2015-10-08 23:38:07 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-10-13 13:59:56 +0200 |
commit | 514ed62ed3f6846325d9bfb15cb5c3540547f13b (patch) | |
tree | 3293f233a9b21034a0f98d6a9043844b15efe718 /net/hsr | |
parent | cc4998febd567d1c671684abce5595344bd4e8b2 (diff) | |
download | linux-514ed62ed3f6846325d9bfb15cb5c3540547f13b.tar.bz2 |
netfilter: sync with packet rx also after removing queue entries
We need to sync packet rx again after flushing the queue entries.
Otherwise, the following race could happen:
cpu1: nf_unregister_hook(H) called, H unliked from lists, calls
synchronize_net() to wait for packet rx completion.
Problem is that while no new nf_queue_entry structs that use H can be
allocated, another CPU might receive a verdict from userspace just before
cpu1 calls nf_queue_nf_hook_drop to remove this entry:
cpu2: receive verdict from userspace, lock queue
cpu2: unlink nf_queue_entry struct E, which references H, from queue list
cpu1: calls nf_queue_nf_hook_drop, blocks on queue spinlock
cpu2: unlock queue
cpu1: nf_queue_nf_hook_drop drops affected queue entries
cpu2: call nf_reinject for E
cpu1: kfree(H)
cpu2: potential use-after-free for H
Cc: Eric W. Biederman <ebiederm@xmission.com>
Fixes: 085db2c04557 ("netfilter: Per network namespace netfilter hooks.")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/hsr')
0 files changed, 0 insertions, 0 deletions