netfilter: gre: nf_ct_gre_keymap_flush() removal
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · Vasily Averin
nf_ct_gre_keymap_flush()is useless.
It is called fromnf_conntrack_cleanup_net_list()only and tries to removenf_ct_gre_keymapentries from pernet gre keymap list. Though:
a) at this point the list should already be empty, all its entries were deleted during the conntracks cleanup, becausenf_conntrack_cleanup_net_list()executesnf_ct_iterate_cleanup(kill_all)beforenf_conntrack_proto_pernet_fini():
nf_conntrack_cleanup_net_list+- nf_ct_iterate_cleanup | nf_ct_put | nf_conntrack_put | nf_conntrack_destroy | destroy_conntrack | destroy_gre_conntrack | nf_ct_gre_keymap_destroy`-
nf_conntrack_proto_pernet_fini
nf_ct_gre_keymap_flush
Quoted 6 lines
b) Let's say we find that the keymap list is not empty. This means netns still has a conntrack associated with gre, in which case we should not free its memory, because this will lead to a double free and related crashes. However I doubt it could have gone unnoticed for years, obviously this does not happen in real life. So I think we can remove both
nf_ct_gre_keymap_flush()andnf_conntrack_proto_pernet_fini().