srmcons: fix kmalloc(GFP_KERNEL) inside spinlock

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>
This commit is contained in:
Andrew Morton 2007-05-06 14:50:39 -07:00 committed by Linus Torvalds
parent ed58a593dc
commit 2af0bc94a6

View file

@ -164,9 +164,9 @@ srmcons_get_private_struct(struct srmcons_private **ps)
int retval = 0; int retval = 0;
if (srmconsp == NULL) { if (srmconsp == NULL) {
srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
spin_lock_irqsave(&srmconsp_lock, flags); spin_lock_irqsave(&srmconsp_lock, flags);
srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
if (srmconsp == NULL) if (srmconsp == NULL)
retval = -ENOMEM; retval = -ENOMEM;
else { else {