greybus: uart: fix double free of tty port
authorRui Miguel Silva <rui.silva@linaro.org>
Fri, 5 Feb 2016 13:50:37 +0000 (13:50 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 6 Feb 2016 00:43:41 +0000 (16:43 -0800)
When inserting and removing a module with a UART protocol defined a
double free of the tty_port would happen and that would generate a lot
of kernel oops in different places related to memory corruption.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/uart.c

index 1ba8476ce982c3ce8019738f872d808eb532232c..46cce8c824122a395af336561dc526eb76d7b594 100644 (file)
@@ -701,7 +701,6 @@ static void gb_uart_connection_exit(struct gb_connection *connection)
 
        /* FIXME - free transmit / receive buffers */
 
-       tty_port_put(&gb_tty->port);
        tty_port_destroy(&gb_tty->port);
        kfree(gb_tty->buffer);
        kfree(gb_tty);