tree c325ab565db7956b966f391714c9155d0aacc83f
parent 48bc41a49c4f3aa760dff84e7f71437f5ed520fe
author Patrick McHardy <[EMAIL PROTECTED]> Wed, 07 Sep 2005 09:47:50 -0700
committer David S. Miller <[EMAIL PROTECTED]> Wed, 07 Sep 2005 09:47:50 -0700

[NET]: proto_unregister: fix sleeping while atomic

proto_unregister holds a lock while calling kmem_cache_destroy, which
can sleep.

Noticed by Daniele Orlandi <[EMAIL PROTECTED]>.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

 net/core/sock.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
--- 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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to