diff options
-rw-r--r-- | net/core/sock.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 629ab4a5b45b..f52c87a9268a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1359,8 +1359,6 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
1359 | { | 1359 | { |
1360 | int rc = -ENOBUFS; | 1360 | int rc = -ENOBUFS; |
1361 | 1361 | ||
1362 | write_lock(&proto_list_lock); | ||
1363 | |||
1364 | if (alloc_slab) { | 1362 | if (alloc_slab) { |
1365 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, | 1363 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, |
1366 | SLAB_HWCACHE_ALIGN, NULL, NULL); | 1364 | SLAB_HWCACHE_ALIGN, NULL, NULL); |
@@ -1368,14 +1366,15 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
1368 | if (prot->slab == NULL) { | 1366 | if (prot->slab == NULL) { |
1369 | printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", | 1367 | printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", |
1370 | prot->name); | 1368 | prot->name); |
1371 | goto out_unlock; | 1369 | goto out; |
1372 | } | 1370 | } |
1373 | } | 1371 | } |
1374 | 1372 | ||
1373 | write_lock(&proto_list_lock); | ||
1375 | list_add(&prot->node, &proto_list); | 1374 | list_add(&prot->node, &proto_list); |
1376 | rc = 0; | ||
1377 | out_unlock: | ||
1378 | write_unlock(&proto_list_lock); | 1375 | write_unlock(&proto_list_lock); |
1376 | rc = 0; | ||
1377 | out: | ||
1379 | return rc; | 1378 | return rc; |
1380 | } | 1379 | } |
1381 | 1380 | ||