]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
fix spinlock recursion in hvc_console
authorChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 7 Aug 2008 07:18:34 +0000 (09:18 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 12 Aug 2008 07:52:55 +0000 (17:52 +1000)
commit 611e097d7707741a336a0677d9d69bec40f29f3d
Author: Christian Borntraeger <borntraeger@de.ibm.com>
hvc_console: rework setup to replace irq functions with callbacks
introduced a spinlock recursion problem.

request_irq tries to call the handler if the IRQ is shared.
The irq handler of hvc_console calls hvc_poll and hvc_kill
which might take the hvc_struct spinlock. Therefore, we have
to call request_irq outside the spinlock.

We can move the notifier_add safely outside the spinlock as ->data must
not be changed by the backend. Otherwise, tty_hangup would fail anyway.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/hvc_console.c

index 02aac104842d91033077da4488926fccfc7daa3d..fd64137b1ab915fb9384fa674ad54be65c5f0074 100644 (file)
@@ -322,11 +322,10 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
 
        hp->tty = tty;
 
-       if (hp->ops->notifier_add)
-               rc = hp->ops->notifier_add(hp, hp->data);
-
        spin_unlock_irqrestore(&hp->lock, flags);
 
+       if (hp->ops->notifier_add)
+               rc = hp->ops->notifier_add(hp, hp->data);
 
        /*
         * If the notifier fails we return an error.  The tty layer