Skip to contentSkip to conversation

spurious hangups on serial console

PATCH Guy M. Streeter 1 participant 1 message Oct 27, 2003 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

I have been investigating a situation where the login prompt begins to
fail on a serial console. What I have discovered is that there is an unexpected call to the serial driver's hangup() routine, between the login prompt and the password prompt.
I traced this to do_tty_hangup() (called from sys_vhangup), and I see
that it attempts to avoid calling the driver's hangup() routine for the console device. The test for the console doesn't account for serial console. The attached patch adds a check for ttyS0 if serial console is configured.
I only see this problem only recent kernels, and I don't know what
changed to make it start happening. Perhaps someone else has a better idea?

--Guy

drivers/char/tty_io.c renamed from drivers/char/tty_io.c.orig +4 -0
@@ -109,6 +109,7 @@ extern void con_init_devfs (void);
 extern void disable_early_printk(void);
 
 #define CONSOLE_DEV MKDEV(TTY_MAJOR,0)
+#define SERIAL_CONSOLE_DEV MKDEV(TTY_MAJOR,64)
 #define TTY_DEV MKDEV(TTYAUX_MAJOR,0)
 #define SYSCONS_DEV MKDEV(TTYAUX_MAJOR,1)
 #define PTMX_DEV MKDEV(TTYAUX_MAJOR,2)
@@ -461,6 +462,9 @@ void do_tty_hangup(void *data)
 	for (l = tty->tty_files.next; l != &tty->tty_files; l = l->next) {
 		struct file * filp = list_entry(l, struct file, f_list);
 		if (filp->f_dentry->d_inode->i_rdev == CONSOLE_DEV ||
+#ifdef CONFIG_SERIAL_CONSOLE
+		    filp->f_dentry->d_inode->i_rdev == SERIAL_CONSOLE_DEV ||
+#endif
 		    filp->f_dentry->d_inode->i_rdev == SYSCONS_DEV) {
 			cons_filp = filp;
 			continue;