From: Patrick McHardy Date: Wed, 7 Sep 2005 02:47:50 +0000 (-0700) Subject: [NET]: proto_unregister: fix sleeping while atomic X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a3f4358ac6283fe3a565183eaf9716de28b6fd0;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git [NET]: proto_unregister: fix sleeping while atomic proto_unregister holds a lock while calling kmem_cache_destroy, which can sleep. Noticed by Daniele Orlandi . Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- 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); void proto_unregister(struct proto *prot) { write_lock(&proto_list_lock); + list_del(&prot->node); + write_unlock(&proto_list_lock); if (prot->slab != NULL) { kmem_cache_destroy(prot->slab); @@ -1550,9 +1552,6 @@ void proto_unregister(struct proto *prot) kfree(name); prot->twsk_slab = NULL; } - - list_del(&prot->node); - write_unlock(&proto_list_lock); } EXPORT_SYMBOL(proto_unregister);