]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tty: serial: lpuart: avoid leaking struct tty_struct
authorStefan Agner <stefan@agner.ch>
Tue, 28 Aug 2018 10:44:24 +0000 (12:44 +0200)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:51:12 +0000 (19:51 -0600)
commit8ca451e6d3db0e0f0d18705848a6e7d519834f41
tree3c47f599b08da81e2680137475140cf3b4ddb623
parent568823f94792a4bcf1aacc8b34043acad5384873
tty: serial: lpuart: avoid leaking struct tty_struct

BugLink: https://bugs.launchpad.net/bugs/1836287
commit 3216c622a24b0ebb9c159a8d1daf7f17a106b3f5 upstream.

The function tty_port_tty_get() gets a reference to the tty. Since
the code is not using tty_port_tty_set(), the reference is kept
even after closing the tty.

Avoid using tty_port_tty_get() by directly access the tty instance.
Since lpuart_start_rx_dma() is called from the .startup() and
.set_termios() callback, it is safe to assume the tty instance is
valid.

Cc: stable@vger.kernel.org # v4.9+
Fixes: 5887ad43ee02 ("tty: serial: fsl_lpuart: Use cyclic DMA for Rx")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/tty/serial/fsl_lpuart.c