patch-2.0.37 linux/drivers/char/tty_io.c

Next file: linux/drivers/isdn/isdn_net.c
Previous file: linux/drivers/char/tga.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.36/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -964,7 +964,13 @@
 	 * Failures after this point use release_mem to clean up, so 
 	 * there's no need to null out the local pointers.
 	 */
-	driver->table[idx] = tty;
+	driver->table[idx] = tty;	/* FIXME: this is broken and
+	probably causes ^D bug. tty->private_date does not (yet) point
+	to a console, if keypress comes now, await armagedon. 
+
+	also, driver->table is accessed from interrupt for vt case,
+	and this does not look like atomic access at all. */
+	
 	if (!*tp_loc)
 		*tp_loc = tp;
 	if (!*ltp_loc)
@@ -1926,8 +1932,9 @@
 {
 	int	retval;
 	struct tty_driver *p;
-	int	found = 0;
+	int	i, found = 0;
 	const char *othername = NULL;
+	struct termios *tp;
 	
 	if (*driver->refcount)
 		return -EBUSY;
@@ -1957,6 +1964,18 @@
 	if (driver->next)
 		driver->next->prev = driver->prev;
 
+	for (i = 0; i < driver->num; i++) {
+		tp = driver->termios[i];
+		if (tp != NULL) {
+			kfree_s(tp, sizeof(struct termios));
+			driver->termios[i] = NULL;
+		}
+		tp = driver->termios_locked[i];
+		if (tp != NULL) {
+			kfree_s(tp, sizeof(struct termios));
+			driver->termios_locked[i] = NULL;
+		}
+	}
 	return 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov