diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 7e7f6514fb53262352266e2c538403b4c8245856..15f7195f4b4c888b97f14016608bbd5038fe26c4 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1596,7 +1596,9 @@ static void n_tty_close(struct tty_struct *tty) { struct n_tty_data *ldata = tty->disc_data; - n_tty_flush_buffer(tty); + if (tty->link) + n_tty_packet_mode_flush(tty); + kfree(ldata->read_buf); kfree(ldata->echo_buf); kfree(ldata);