aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-09-06 22:47:50 -0400
committerDavid S. Miller <davem@davemloft.net>2005-09-06 22:47:50 -0400
commit0a3f4358ac6283fe3a565183eaf9716de28b6fd0 (patch)
treec325ab565db7956b966f391714c9155d0aacc83f /net/core/sock.c
parent48bc41a49c4f3aa760dff84e7f71437f5ed520fe (diff)
[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>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index b32b1815ae5a..ac63b56e23b2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1529,6 +1529,8 @@ EXPORT_SYMBOL(proto_register);
1529void proto_unregister(struct proto *prot) 1529void proto_unregister(struct proto *prot)
1530{ 1530{
1531 write_lock(&proto_list_lock); 1531 write_lock(&proto_list_lock);
1532 list_del(&prot->node);
1533 write_unlock(&proto_list_lock);
1532 1534
1533 if (prot->slab != NULL) { 1535 if (prot->slab != NULL) {
1534 kmem_cache_destroy(prot->slab); 1536 kmem_cache_destroy(prot->slab);
@@ -1550,9 +1552,6 @@ void proto_unregister(struct proto *prot)
1550 kfree(name); 1552 kfree(name);
1551 prot->twsk_slab = NULL; 1553 prot->twsk_slab = NULL;
1552 } 1554 }
1553
1554 list_del(&prot->node);
1555 write_unlock(&proto_list_lock);
1556} 1555}
1557 1556
1558EXPORT_SYMBOL(proto_unregister); 1557EXPORT_SYMBOL(proto_unregister);