lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 23 Nov 2012 22:42:46 +0400
From:	Ilya Zykov <ilya@...x.ru>
To:	Alan Cox <alan@...ux.intel.com>
CC:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Andrew McGregor <andrew.mcgregor@...iedtelesis.co.nz>,
	linux-kernel@...r.kernel.org, ilya@...x.ru
Subject: [PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers.

This patch correct tty serial drivers.

Unfortunately, many drivers indirectly call ldisc's flush_buffer() function 
in own callback function close(). Рarticularly, by the use of tty_ldisc_flush(),
before TTY LAYER calls ldisc's flush_buffer() in the right moment.

1. It disturb the logic of work ldisc's layer.
2. It is simple overhead because we call ldisc's flush_buffer() at least two times.

Signed-off-by: Ilya Zykov <ilya@...x.ru>
---

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a21dc8e..c4a0a6d 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1288,7 +1288,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
        uart_shutdown(tty, state);
        uart_flush_buffer(tty);
 
-       tty_ldisc_flush(tty);
+       tty_buffer_flush(tty);
 
        tty_port_tty_set(port, NULL);
        spin_lock_irqsave(&port->lock, flags);
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index bf6e238..c23dd30 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -364,8 +364,8 @@ int tty_port_close_start(struct tty_port *port,
                        timeout = 2 * HZ;
                schedule_timeout_interruptible(timeout);
        }
-       /* Flush the ldisc buffering */
-       tty_ldisc_flush(tty);
+       /* Flush the driver buffering */
+       tty_buffer_flush(tty);
 
        /* Drop DTR/RTS if HUPCL is set. This causes any attached modem to
           hang up the line */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ