Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files

Christoph Hellwig
2003-04-21T19:44:37Z

On Mon, Apr 21, 2003 at 03:44:07PM -0400, Pavel Roskin wrote:
> Following is happening. The system boots, /dev/pts is a directory (I can
> see it by logging on the serial console). devpts is mounted on /dev/pts.
>
> I log in by ssh. It works. /dev/pts/0 appears. I log out. /dev/pts
> directory disappears!
>
> I log in by ssh again. I get this message on the console:
>
> devfs_remove: no entry for pts!
>
> ssh hangs. I can recreate /dev/pts by mkdir, umount it and mount it
> again. Then ssh works again, but again only once. /dev/pts disappears on
> logout.

Oh, I see now. There's a longstanding bug in the handling of
TTY_DRIVER_NO_DEVFS that got exposed by this.

Please try this patch additionally:

--- 1.78/drivers/char/tty_io.c Sat Apr 19 19:24:04 2003
+++ edited/drivers/char/tty_io.c Mon Apr 21 20:33:35 2003
@@ -2139,12 +2139,14 @@
*/
void tty_register_device(struct tty_driver *driver, unsigned minor)
{
- tty_register_devfs(driver, minor);
+ if (!(driver->flags & TTY_DRIVER_NO_DEVFS))
+ tty_register_devfs(driver, minor);
}

void tty_unregister_device(struct tty_driver *driver, unsigned minor)
{
- tty_unregister_devfs(driver, minor);
+ if (!(driver->flags & TTY_DRIVER_NO_DEVFS))
+ tty_unregister_devfs(driver, minor);
}

EXPORT_SYMBOL(tty_register_device);
@@ -2173,10 +2175,8 @@

list_add(&driver->tty_drivers, &tty_drivers);

- if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
- for(i = 0; i < driver->num; i++)
- tty_register_device(driver, driver->minor_start + i);
- }
+ for (i = 0; i < driver->num; i++)
+ tty_register_device(driver, driver->minor_start + i);
proc_tty_register_driver(driver);
return error;
}