aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>2005-04-16 15:24:09 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:24:09 -0700
commit2a27805127aee1e7e62854bcf9ca8c355c23b73e (patch)
treed76f7f634e43bf3797657c5cb2d2b222ffd76f8b /net/core
parent9f3786dc8b1d6229dbe76e364323f0d787e7a0ea (diff)
[PATCH] net: don't call kmem_cache_create with a spinlock held
This fixes the warning reported by Marcel Holtmann (Thanks!). Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 629ab4a5b45..f52c87a9268 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1359,8 +1359,6 @@ int proto_register(struct proto *prot, int alloc_slab)
{
int rc = -ENOBUFS;
- write_lock(&proto_list_lock);
-
if (alloc_slab) {
prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
@@ -1368,14 +1366,15 @@ int proto_register(struct proto *prot, int alloc_slab)
if (prot->slab == NULL) {
printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
prot->name);
- goto out_unlock;
+ goto out;
}
}
+ write_lock(&proto_list_lock);
list_add(&prot->node, &proto_list);
- rc = 0;
-out_unlock:
write_unlock(&proto_list_lock);
+ rc = 0;
+out:
return rc;
}