OSDN Git Service

staging: speakup: safely close tty
authorOkash Khawaja <okash.khawaja@gmail.com>
Sun, 16 Jul 2017 09:28:21 +0000 (10:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jul 2017 07:03:21 +0000 (09:03 +0200)
Speakup opens tty using tty_open_by_driver. When closing, it calls
tty_ldisc_release but doesn't close and remove the tty itself. As a
result, that tty cannot be opened from user space. This patch calls
tty_release_struct which ensures that tty is safely removed and freed
up. It also calls tty_ldisc_release, so speakup doesn't need to call it.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/speakup/spk_ttyio.c

index ed8e96b..924034a 100644 (file)
@@ -300,7 +300,7 @@ void spk_ttyio_release(void)
 
        tty_ldisc_flush(speakup_tty);
        tty_unlock(speakup_tty);
-       tty_ldisc_release(speakup_tty);
+       tty_release_struct(speakup_tty, speakup_tty->index);
 }
 EXPORT_SYMBOL_GPL(spk_ttyio_release);