]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: fix possible removal of wrong hook
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 20 Jul 2015 07:31:25 +0000 (09:31 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 23 Jul 2015 14:18:34 +0000 (16:18 +0200)
commit3d0c685606b24d0af3573068b9a886b9d0fe12e1
tree078443bc82e57f80bb59368253e59d9d57c6a6f3
parentc767d2fc3d19346f05a64fe8c3699848e9694e08
netfilter: fix possible removal of wrong hook

nf_unregister_net_hook() uses the nf_hook_ops fields as tuple to look up for
the corresponding hook in the list. However, we may have two hooks with exactly
the same configuration.

This shouldn't be a problem for nftables since every new chain has an unique
priv field set, but this may still cause us problems in the future, so better
address this problem now by keeping a reference to the original nf_hook_ops
structure to make sure we delete the right hook from nf_unregister_net_hook().

Fixes: 0aacf4be7b8e ("netfilter: Per network namespace netfilter hooks.")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
net/netfilter/core.c