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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091112140504.6daf3824@pedra.chehab.org>
Date:	Thu, 12 Nov 2009 14:05:04 -0200
From:	Mauro Carvalho Chehab <mchehab@...hat.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Eran Liberty <liberty@...ricom.com>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] serial_core: avoid Break bouncing

From: Eran Liberty <liberty@...ricom.com>

On some boxes, Break signal bounces, causing sysrq code to fail with some
serial interfaces.

A solution were posted on LKML in 2008:
http://lkml.indiana.edu/hypermail/linux/kernel/0809.2/0730.html

However, the fix weren't applied upstream.

This bug keeps happening, as shown at:
	https://bugzilla.redhat.com/show_bug.cgi?id=518120

The original patch from Eran adds a debouncing logic that avoids that
multiple breaks to be badly handled by the serial code.

[mchehab@...hat.com: port the patch upstream and fix CodingStyle]

Signed-off-by: Mauro Carvalho Chehab <mchehab@...hat.com>

diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index db532ce..765e169 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -443,8 +443,8 @@ static inline int
 uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
 {
 #ifdef SUPPORT_SYSRQ
-	if (port->sysrq) {
-		if (ch && time_before(jiffies, port->sysrq)) {
+	if (port->sysrq && time_after(jiffies, port->sysrq + HZ / 50)) {
+		if (ch && time_before(jiffies, port->sysrq + HZ * 5)) {
 			handle_sysrq(ch, port->state->port.tty);
 			port->sysrq = 0;
 			return 1;
@@ -464,18 +464,17 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
 static inline int uart_handle_break(struct uart_port *port)
 {
 	struct uart_state *state = port->state;
+	int ret = 0;
+
 #ifdef SUPPORT_SYSRQ
 	if (port->cons && port->cons->index == port->line) {
-		if (!port->sysrq) {
-			port->sysrq = jiffies + HZ*5;
-			return 1;
-		}
-		port->sysrq = 0;
+		port->sysrq = jiffies;
+		ret = 1;
 	}
 #endif
 	if (port->flags & UPF_SAK)
 		do_SAK(state->port.tty);
-	return 0;
+	return ret;
 }
 
 /**

--
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