Commit 2a278051 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Linus Torvalds

[PATCH] net: don't call kmem_cache_create with a spinlock held

This fixes the warning reported by Marcel Holtmann (Thanks!).
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9f3786dc
...@@ -1359,8 +1359,6 @@ int proto_register(struct proto *prot, int alloc_slab) ...@@ -1359,8 +1359,6 @@ int proto_register(struct proto *prot, int alloc_slab)
{ {
int rc = -ENOBUFS; int rc = -ENOBUFS;
write_lock(&proto_list_lock);
if (alloc_slab) { if (alloc_slab) {
prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
SLAB_HWCACHE_ALIGN, NULL, NULL); SLAB_HWCACHE_ALIGN, NULL, NULL);
...@@ -1368,14 +1366,15 @@ int proto_register(struct proto *prot, int alloc_slab) ...@@ -1368,14 +1366,15 @@ int proto_register(struct proto *prot, int alloc_slab)
if (prot->slab == NULL) { if (prot->slab == NULL) {
printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
prot->name); prot->name);
goto out_unlock; goto out;
} }
} }
write_lock(&proto_list_lock);
list_add(&prot->node, &proto_list); list_add(&prot->node, &proto_list);
rc = 0;
out_unlock:
write_unlock(&proto_list_lock); write_unlock(&proto_list_lock);
rc = 0;
out:
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment