Skip to content

Commit 42df4fb

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: cttimeout: decouple unlink and free on netns destruction
Increment the extid on module removal; this makes sure that even in extreme cases any old uncofirmed entry that happened to be kept e.g. on nfnetlink_queue list will not trip over a stale timeout reference. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent c56716c commit 42df4fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/netfilter/nfnetlink_cttimeout.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,24 @@ static int __init cttimeout_init(void)
656656
return ret;
657657
}
658658

659+
static int untimeout(struct nf_conn *ct, void *timeout)
660+
{
661+
struct nf_conn_timeout *timeout_ext = nf_ct_timeout_find(ct);
662+
663+
if (timeout_ext)
664+
RCU_INIT_POINTER(timeout_ext->timeout, NULL);
665+
666+
return 0;
667+
}
668+
659669
static void __exit cttimeout_exit(void)
660670
{
661671
nfnetlink_subsys_unregister(&cttimeout_subsys);
662672

663673
unregister_pernet_subsys(&cttimeout_ops);
664674
RCU_INIT_POINTER(nf_ct_timeout_hook, NULL);
675+
676+
nf_ct_iterate_destroy(untimeout, NULL);
665677
synchronize_rcu();
666678
}
667679

0 commit comments

Comments
 (0)