mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: akpm@osdl.org
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org,
	acme@conectiva.com.br, davem@davemloft.net
Subject: [patch 021/198] net: don't call kmem_cache_create with a spinlock held
Date: Tue, 12 Apr 2005 03:30:52 -0700	[thread overview]
Message-ID: <200504121030.j3CAUw0e005195@shell0.pdx.osdl.net> (raw)


From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>

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>
---

 25-akpm/net/core/sock.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff -puN net/core/sock.c~dont-call-kmem_cache_create-with-a-spinlock-held net/core/sock.c
--- 25/net/core/sock.c~dont-call-kmem_cache_create-with-a-spinlock-held	2005-04-12 03:21:08.325871176 -0700
+++ 25-akpm/net/core/sock.c	2005-04-12 03:21:08.329870568 -0700
@@ -1359,8 +1359,6 @@ int proto_register(struct proto *prot, i
 {
 	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, i
 		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;
 }
 
_

                 reply	other threads:[~2005-04-12 17:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200504121030.j3CAUw0e005195@shell0.pdx.osdl.net \
    --to=akpm@osdl.org \
    --cc=acme@conectiva.com.br \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®