Skip to content

Commit

Permalink
hvc_console: Fix free_irq in spinlocked section
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. The notifier_del is
    called with a lock held, and in turns calls free_irq which then
    complains when manipulating procfs. This fixes it by moving the
    call to the notifier to outside of the locked section.

Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Christian Borntraeger authored and Benjamin Herrenschmidt committed Oct 14, 2008
1 parent f5ea64d commit eef2622
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/char/hvc_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,13 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
spin_lock_irqsave(&hp->lock, flags);

if (--hp->count == 0) {
if (hp->ops->notifier_del)
hp->ops->notifier_del(hp, hp->data);

/* We are done with the tty pointer now. */
hp->tty = NULL;
spin_unlock_irqrestore(&hp->lock, flags);

if (hp->ops->notifier_del)
hp->ops->notifier_del(hp, hp->data);

/*
* Chain calls chars_in_buffer() and returns immediately if
* there is no buffered data otherwise sleeps on a wait queue
Expand Down Expand Up @@ -416,11 +416,11 @@ static void hvc_hangup(struct tty_struct *tty)
hp->n_outbuf = 0;
hp->tty = NULL;

spin_unlock_irqrestore(&hp->lock, flags);

if (hp->ops->notifier_del)
hp->ops->notifier_del(hp, hp->data);

spin_unlock_irqrestore(&hp->lock, flags);

while(temp_open_count) {
--temp_open_count;
kref_put(&hp->kref, destroy_hvc_struct);
Expand Down

0 comments on commit eef2622

Please sign in to comment.