USB: console: fix potential use after free
commit23c631c3dbe28d5f89e70c4da7b4313177a4dc40
authorJohan Hovold <johan@kernel.org>
Mon, 5 Jan 2015 15:04:13 +0000 (5 16:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Jan 2015 16:18:57 +0000 (27 08:18 -0800)
treed34a61482e83cefea52d926275df78ae380cc2b6
parent8438d81444fe8338ccf8b43538ce6aacf4cd3c39
USB: console: fix potential use after free

commit 32a4bf2e81ec378e5925d4e069e0677a6c86a6ad upstream.

Use tty kref to release the fake tty in usb_console_setup to avoid use
after free if the underlying serial driver has acquired a reference.

Note that using the tty destructor release_one_tty requires some more
state to be initialised.

Fixes: 4a90f09b20f4 ("tty: usb-serial krefs")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/console.c