srmcons: fix kmalloc(GFP_KERNEL) inside spinlock
authorAndrew Morton <akpm@linux-foundation.org>
Sun, 6 May 2007 21:50:39 +0000 (14:50 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 7 May 2007 19:12:58 +0000 (12:12 -0700)
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=8341

Cc: <matthias.kaehlcke@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/alpha/kernel/srmcons.c

index 75692320386080c25a730f1e78779b1851f75926..85a821aaceb47d68c822e3b656b471ded8a30d65 100644 (file)
@@ -164,9 +164,9 @@ srmcons_get_private_struct(struct srmcons_private **ps)
        int retval = 0;
 
        if (srmconsp == NULL) {
+               srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
                spin_lock_irqsave(&srmconsp_lock, flags);
 
-               srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
                if (srmconsp == NULL)
                        retval = -ENOMEM;
                else {