Skip to content

Commit

Permalink
TTY: hvc_console, fix port reference count going to zero prematurely
Browse files Browse the repository at this point in the history
Commit bdb498c "TTY: hvc_console, add tty install" took the port
refcounting out of hvc_open()/hvc_close(), but failed to remove the
kref_put() and tty_kref_put() calls in hvc_hangup() that were there to
remove the extra references that hvc_open() had taken.

The result was that doing a vhangup() when the current terminal was
a hvc_console, then closing the current terminal, would end up calling
destroy_hvc_struct() and making the port disappear entirely.  This
meant that Fedora 17 systems would boot up but then not display the
login prompt on the console, and attempts to open /dev/hvc0 would
give a "No such device" error.

This fixes it by removing the extra kref_put() and tty_kref_put() calls.

Signed-off-by: Paul Mackerras <[email protected]>
Acked-by: Jiri Slaby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
paulusmack authored and gregkh committed Nov 14, 2012
1 parent 77b6706 commit c019bc1
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/tty/hvc/hvc_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ static void hvc_hangup(struct tty_struct *tty)
{
struct hvc_struct *hp = tty->driver_data;
unsigned long flags;
int temp_open_count;

if (!hp)
return;
Expand All @@ -444,7 +443,6 @@ static void hvc_hangup(struct tty_struct *tty)
return;
}

temp_open_count = hp->port.count;
hp->port.count = 0;
spin_unlock_irqrestore(&hp->port.lock, flags);
tty_port_tty_set(&hp->port, NULL);
Expand All @@ -453,11 +451,6 @@ static void hvc_hangup(struct tty_struct *tty)

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

while(temp_open_count) {
--temp_open_count;
tty_port_put(&hp->port);
}
}

/*
Expand Down

0 comments on commit c019bc1

Please sign in to comment.