Files
linux/drivers
Amit Shah ef5ce99dff hvc_console: Fix race between hvc_close and hvc_remove
commit e74d098c66 upstream.

Alan pointed out a race in the code where hvc_remove is invoked. The
recent virtio_console work is the first user of hvc_remove().

Alan describes it thus:

The hvc_console assumes that a close and remove call can't occur at the
same time.

In addition tty_hangup(tty) is problematic as tty_hangup is asynchronous
itself....

So this can happen

        hvc_close                               hvc_remove
        hung up ? - no
                                                lock
                                                tty = hp->tty
                                                unlock
        lock
        hp->tty = NULL
        unlock
        notify del
        kref_put the hvc struct
        close completes
        tty is destroyed
                                                tty_hangup dead tty
                                                tty->ops will be NULL
                                                NULL->...

This patch adds some tty krefs and also converts to using tty_vhangup().

Reported-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Alan Cox <alan@lxorguk.ukuu.org.uk>
CC: linuxppc-dev@ozlabs.org
CC: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-07 14:43:12 -08:00
..
2011-01-07 14:43:06 -08:00
2010-08-26 16:41:51 -07:00
2010-08-26 16:41:42 -07:00
2009-10-15 09:58:27 -06:00
2009-11-12 07:26:01 -08:00
2010-08-02 10:20:53 -07:00
2010-08-13 13:20:13 -07:00
2010-08-02 10:20:42 -07:00
2010-05-12 14:57:15 -07:00