[NET]: proto_unregister: fix sleeping while atomic
proto_unregister holds a lock while calling kmem_cache_destroy, which can sleep. Noticed by Daniele Orlandi <daniele@orlandi.com>. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
48bc41a49c
commit
0a3f4358ac
@@ -1529,6 +1529,8 @@ EXPORT_SYMBOL(proto_register);
|
|||||||
void proto_unregister(struct proto *prot)
|
void proto_unregister(struct proto *prot)
|
||||||
{
|
{
|
||||||
write_lock(&proto_list_lock);
|
write_lock(&proto_list_lock);
|
||||||
|
list_del(&prot->node);
|
||||||
|
write_unlock(&proto_list_lock);
|
||||||
|
|
||||||
if (prot->slab != NULL) {
|
if (prot->slab != NULL) {
|
||||||
kmem_cache_destroy(prot->slab);
|
kmem_cache_destroy(prot->slab);
|
||||||
@@ -1550,9 +1552,6 @@ void proto_unregister(struct proto *prot)
|
|||||||
kfree(name);
|
kfree(name);
|
||||||
prot->twsk_slab = NULL;
|
prot->twsk_slab = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_del(&prot->node);
|
|
||||||
write_unlock(&proto_list_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(proto_unregister);
|
EXPORT_SYMBOL(proto_unregister);
|
||||||
|
Reference in New Issue
Block a user