]> 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)
commite7fce8e7854acad25b468f352cb6e628321fc223
tree078443bc82e57f80bb59368253e59d9d57c6a6f3
parent63370e033d81458d1dbca0733e327fc9841d66ac
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: 135e933cfbc6 ("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