inet: frags: call inet_frags_fini() after unregister_pernet_subsys()
authorEric Dumazet <edumazet@google.com>
Mon, 27 May 2019 23:56:48 +0000 (16:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:50:51 +0000 (14:50 +0100)
commit684880d89a9332a78362ea030e40d6cf0062727e
treeb6a60305daf8e8342eca386a238ddf9394480698
parente6a13c753f912564256d81f7036f9c524b1ef8ae
inet: frags: call inet_frags_fini() after unregister_pernet_subsys()

[ Upstream commit ae7352d384a552d8c799c242e74a934809990a71 ]

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: d4ad4d22e7ac ("inet: frags: use kmem_cache for inet_frag_queue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ieee802154/6lowpan/reassembly.c
net/ipv6/reassembly.c