Messages in this thread Patch in this message | | | Date | Wed, 21 Jul 2004 18:45:47 +0400 | From | "Vladimir B. Savkin" <> | Subject | UNIX98 pty indices leak |
| |
Hello!
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 (tested on 2.6.7-mm7, but applies cleanly to 2.6.8-rc2).
--- tmp/linux-2.6.7/drivers/char/tty_io.c Wed Jul 21 17:47:18 2004 +++ linux-2.6.7/drivers/char/tty_io.c Wed Jul 21 17:54:33 2004 @@ -1060,7 +1060,7 @@ { 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]; @@ -1075,7 +1075,8 @@ 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 @@ -1300,7 +1301,7 @@ #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); ~ :wq With best regards, Vladimir Savkin.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |