diff options
author | Jiri Kosina <jkosina@suse.cz> | 2007-03-28 18:12:34 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-28 13:58:02 -0700 |
commit | 4dfc896e90359df04c80da5ab08ec31e87846c43 (patch) | |
tree | 1d68ae9c2e07c87f7cbc2f4b5c10d98a6c60a874 /drivers/oprofile/event_buffer.c | |
parent | 6faee84b006af55bab9908741dd76916c8450be2 (diff) | |
download | op-kernel-dev-4dfc896e90359df04c80da5ab08ec31e87846c43.zip op-kernel-dev-4dfc896e90359df04c80da5ab08ec31e87846c43.tar.gz |
[PATCH] oprofile: fix potential deadlock on oprofilefs_lock
nmi_cpu_setup() is called from hardirq context and acquires oprofilefs_lock.
alloc_event_buffer() and oprofilefs_ulong_from_user() acquire this lock
without disabling irqs, which could deadlock.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/oprofile/event_buffer.c')
-rw-r--r-- | drivers/oprofile/event_buffer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 00e937e..e7fbac5 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c @@ -70,11 +70,12 @@ void wake_up_buffer_waiter(void) int alloc_event_buffer(void) { int err = -ENOMEM; + unsigned long flags; - spin_lock(&oprofilefs_lock); + spin_lock_irqsave(&oprofilefs_lock, flags); buffer_size = fs_buffer_size; buffer_watershed = fs_buffer_watershed; - spin_unlock(&oprofilefs_lock); + spin_unlock_irqrestore(&oprofilefs_lock, flags); if (buffer_watershed >= buffer_size) return -EINVAL; |