Patch to the serial driver

Theodore Y. Ts'o (tytso@mit.edu)
Tue, 3 Nov 1998 23:39:28 -0500


Hi Linus,

The following patch to the serial driver corrects two bugs. The first
is that if a non-privieged user tries to set some flags, the run-time
flags in info->flags weren't getting set; instead only the long-term
flags in state->flags were getting set.

The second fix is to not allow someone to enter a zero base_baud
configuration, since this would cause a divide by zero error later.

I'd appreciate it if you could get this applied into the mainline kernel
branch. Thanks!!

- Ted

Patch generated: on Tue Nov 3 23:34:46 EST 1998 by tytso@rsts-11.mit.edu
against Linux version 2.1.126

===================================================================
RCS file: drivers/char/RCS/serial.c,v
retrieving revision 1.1
diff -u -r1.1 drivers/char/serial.c
--- drivers/char/serial.c 1998/11/03 02:07:19 1.1
+++ drivers/char/serial.c 1998/11/04 04:34:34
@@ -1653,6 +1653,8 @@
return -EPERM;
state->flags = ((state->flags & ~ASYNC_USR_MASK) |
(new_serial.flags & ASYNC_USR_MASK));
+ info->flags = ((state->flags & ~ASYNC_USR_MASK) |
+ (info->flags & ASYNC_USR_MASK));
state->custom_divisor = new_serial.custom_divisor;
goto check_and_exit;
}
@@ -1660,8 +1662,9 @@
new_serial.irq = irq_cannonicalize(new_serial.irq);

if ((new_serial.irq >= NR_IRQS) || (new_serial.port > 0xffff) ||
- (new_serial.type < PORT_UNKNOWN) ||
- (new_serial.type > PORT_MAX)) {
+ (new_serial.baud_base == 0) || (new_serial.type < PORT_UNKNOWN) ||
+ (new_serial.type > PORT_MAX) || (new_serial.type == PORT_CIRRUS) ||
+ (new_serial.type == PORT_STARTECH)) {
return -EINVAL;
}

===================================================================
RCS file: include/linux/RCS/serial.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/serial.h
--- include/linux/serial.h 1998/11/03 02:07:19 1.1
+++ include/linux/serial.h 1998/11/03 02:28:15
@@ -42,11 +42,11 @@
#define PORT_16450 2
#define PORT_16550 3
#define PORT_16550A 4
-#define PORT_CIRRUS 5
+#define PORT_CIRRUS 5 /* usurped by cyclades.c */
#define PORT_16650 6
#define PORT_16650V2 7
#define PORT_16750 8
-#define PORT_STARTECH 9
+#define PORT_STARTECH 9 /* usurped by cyclades.c */
#define PORT_MAX 9

struct serial_uart_config {
@@ -87,7 +87,7 @@

#define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */

-#define ASYNC_FLAGS 0x2FFF /* Possible legal async flags */
+#define ASYNC_FLAGS 0x3FFF /* Possible legal async flags */
#define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged
* users can set or reset */

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