USB: console: fix potential use after free
authorJohan Hovold <johan@kernel.org>
Mon, 5 Jan 2015 15:04:13 +0000 (16:04 +0100)
committerJiri Slaby <jslaby@suse.cz>
Thu, 29 Jan 2015 14:44:39 +0000 (15:44 +0100)
commit8f3084c44b70ee9e8f5b6bd4816a129bc2646f21
treec8c4490fea5ff1156e60e218d7de8eaba30f7d34
parent56dfc960370c6b48c69394fa088935a79c7ab3e4
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: Jiri Slaby <jslaby@suse.cz>
drivers/usb/serial/console.c