Skip to content

Commit

Permalink
fix spinlock recursion in hvc_console
Browse files Browse the repository at this point in the history
commit 611e097
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>
  • Loading branch information
Christian Borntraeger authored and Rusty Russell committed Aug 12, 2008
1 parent ed6d687 commit b1b135c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/char/hvc_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1b135c

Please sign in to comment.