]> git.baikalelectronics.ru Git - kernel.git/commit
printk: replacing the raw_spin_lock/unlock with raw_spin_lock/unlock_irq
authorliu chuansheng <chuansheng.liu@intel.com>
Fri, 6 Jul 2012 16:50:08 +0000 (09:50 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Jul 2012 16:50:08 +0000 (09:50 -0700)
commite930160563e934dbbfb383df873038640a7714ec
treee54c65ff9106c7ac29e9636310722db9d7bb170f
parentcda1d5780ae091596fa4a45c2f1f9794c8e84e36
printk: replacing the raw_spin_lock/unlock with raw_spin_lock/unlock_irq

In function devkmsg_read/writev/llseek/poll/open()..., the function
raw_spin_lock/unlock is used, there is potential deadlock case happening.
CPU1: thread1 doing the cat /dev/kmsg:
        raw_spin_lock(&logbuf_lock);
        while (user->seq == log_next_seq) {
when thread1 run here, at this time one interrupt is coming on CPU1 and running
based on this thread,if the interrupt handle called the printk which need the
logbuf_lock spin also, it will cause deadlock.

So we should use raw_spin_lock/unlock_irq here.

Acked-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/printk.c