mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
netfilter: conntrack: call nf_ct_gre_keymap_destroy() if master helper is pptp
For GRE flows, validate that the ct master helper (if any) is pptp
before calling nf_ct_gre_keymap_destroy(), so the helper data area
can be accessed safely. Note that only the pptp helper provides a
.destroy callback.
Fixes: e56894356f ("netfilter: conntrack: remove l4proto destroy hook")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
35e21a4dcc
commit
b0f02608fb
|
|
@ -562,9 +562,23 @@ static void destroy_gre_conntrack(struct nf_conn *ct)
|
|||
{
|
||||
#ifdef CONFIG_NF_CT_PROTO_GRE
|
||||
struct nf_conn *master = ct->master;
|
||||
struct nf_conn_help *help;
|
||||
|
||||
if (master)
|
||||
nf_ct_gre_keymap_destroy(master);
|
||||
if (!master)
|
||||
return;
|
||||
|
||||
help = nfct_help(master);
|
||||
if (help) {
|
||||
struct nf_conntrack_helper *helper;
|
||||
|
||||
rcu_read_lock();
|
||||
helper = rcu_dereference(help->helper);
|
||||
/* Only pptp helper has a destroy callback. */
|
||||
if (helper && helper->destroy)
|
||||
nf_ct_gre_keymap_destroy(master);
|
||||
|
||||
rcu_read_unlock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user