From: "Vladimir B. Savkin" I noticed that our PPPoE/PPtP access concentrator leaks pty devices. When all 4096 indices are leaked, there was need to reboot it. The following patch fixes this problem. Signed-off-by: Andrew Morton --- 25-akpm/drivers/char/tty_io.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff -puN drivers/char/tty_io.c~unix98-pty-indices-leak drivers/char/tty_io.c --- 25/drivers/char/tty_io.c~unix98-pty-indices-leak 2004-07-27 00:08:39.725018472 -0700 +++ 25-akpm/drivers/char/tty_io.c 2004-07-27 00:08:39.731017560 -0700 @@ -1068,7 +1068,7 @@ static void release_dev(struct file * fi { struct tty_struct *tty, *o_tty; int pty_master, tty_closing, o_tty_closing, do_sleep; - int devpts_master; + int devpts_master, devpts; int idx; char buf[64]; @@ -1083,7 +1083,8 @@ static void release_dev(struct file * fi idx = tty->index; pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER); - devpts_master = pty_master && (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM); + devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0; + devpts_master = pty_master && devpts; o_tty = tty->link; #ifdef TTY_PARANOIA_CHECK @@ -1308,7 +1309,7 @@ static void release_dev(struct file * fi #ifdef CONFIG_UNIX98_PTYS /* Make this pty number available for reallocation */ - if (devpts_master) { + if (devpts) { down(&allocated_ptys_lock); idr_remove(&allocated_ptys, idx); up(&allocated_ptys_lock); _