USB: console: fix potential use after free
authorJohan Hovold <johan@kernel.org>
Mon, 5 Jan 2015 15:04:13 +0000 (16:04 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 20 Feb 2015 00:49:36 +0000 (00:49 +0000)
commit27e5ab9cfb34a9491599c1cc7785755b2c5cb512
tree4f7b9ca5b7462a6b76f3090aeb87bdbdeda59dc2
parent06be755d7d93bfd196e41c8d84b234227a155374
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>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/serial/console.c