Commit 8988fe8c authored by Eric Dumazet's avatar Eric Dumazet Committed by Kleber Sacilotto de Souza

inet: frags: call inet_frags_fini() after unregister_pernet_subsys()

BugLink: https://bugs.launchpad.net/bugs/1864773

[ Upstream commit ae7352d3 ]

Both IPv6 and 6lowpan are calling inet_frags_fini() too soon.

inet_frags_fini() is dismantling a kmem_cache, that might be needed
later when unregister_pernet_subsys() eventually has to remove
frags queues from hash tables and free them.

This fixes potential use-after-free, and is a prereq for the following patch.

Fixes: d4ad4d22 ("inet: frags: use kmem_cache for inet_frag_queue")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 4e6e1661
......@@ -634,7 +634,7 @@ int __init lowpan_net_frag_init(void)
void lowpan_net_frag_exit(void)
{
inet_frags_fini(&lowpan_frags);
lowpan_frags_sysctl_unregister();
unregister_pernet_subsys(&lowpan_frags_ops);
inet_frags_fini(&lowpan_frags);
}
......@@ -790,8 +790,8 @@ int __init ipv6_frag_init(void)
void ipv6_frag_exit(void)
{
inet_frags_fini(&ip6_frags);
ip6_frags_sysctl_unregister();
unregister_pernet_subsys(&ip6_frags_ops);
inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
inet_frags_fini(&ip6_frags);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment