Bug 8341

Summary: srmcons_get_private_struct() calls kmalloc(GFP_KERNEL) while a spinlock is held
Product: Platform Specific/Hardware Reporter: Matthias Kaehlcke (matthias.kaehlcke)
Component: AlphaAssignee: Richard Henderson (rth)
Status: RESOLVED CODE_FIX    
Severity: normal CC: jirislaby
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20 Tree: Mainline
Regression: ---

Description Matthias Kaehlcke 2007-04-16 14:25:56 UTC
Problem Description:

srmcons_get_private_struct() in arch/alpha/kernel/srmcons.c calls
kmalloc(GFP_KERNEL) while the spinlock srmconsp_lock is held. this should not be
done as kmalloc(GFP_KERNEL) might sleep

as srmcons_get_private_struct() is only called from srmcons_open() and never
from interrupt context i think the right thing would be using a mutex instead of
a spinlock
Comment 1 Andrew Morton 2007-04-20 14:36:57 UTC
I queued a fix, thanks.
Comment 2 Jiri Slaby 2012-02-01 16:05:20 UTC
(In reply to comment #1)
> I queued a fix, thanks.

Hrm, that made the race there worse ;). (srmconsp is static)

This happened almost 5 years ago. I wonder if anybody uses that driver at all? 

Matthias do you or did you use some static analysis?