netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][NET] Don't call kmem_cache_create with a spinlock held
@ 2005-04-05 18:25 Arnaldo Carvalho de Melo
  0 siblings, 0 replies; only message in thread
From: Arnaldo Carvalho de Melo @ 2005-04-05 18:25 UTC (permalink / raw)
  To: davem; +Cc: marcel, netdev

[-- Attachment #1: Type: text/plain, Size: 117 bytes --]

Hi David,

	Please pull from:

bk://kernel.bkbits.net/acme/net-2.6

Best Regards,

                        - Arnaldo

[-- Attachment #2: proto_register_lock_fix.patch --]
[-- Type: text/plain, Size: 1173 bytes --]

===================================================================


ChangeSet@1.2245, 2005-04-05 14:52:51-03:00, acme@toy.ghostprotocols.net
  [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>


 sock.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)


diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c	2005-04-05 15:22:27 -03:00
+++ b/net/core/sock.c	2005-04-05 15:22:27 -03:00
@@ -1359,8 +1359,6 @@
 {
 	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 @@
 		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;
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-05 18:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-05 18:25 [PATCH][NET] Don't call kmem_cache_create with a spinlock held Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).