diff options
| author | Vladimir B. Savkin <master@sectorb.msk.ru> | 2004-07-28 08:57:05 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-07-28 08:57:05 -0700 |
| commit | 536c748e52a74d36dc98b6ee461295b43ded4f05 (patch) | |
| tree | ed5f0577c7bbe51c822509e16b8a6fb9966b93f7 | |
| parent | 805540843e4f600f0a1bd0bf989719f77cb9b7f6 (diff) | |
[PATCH] Fix UNIX98 pty indices leak
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 <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | drivers/char/tty_io.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 5e49ad38cff6..c18aaae5cd3f 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -1068,7 +1068,7 @@ static void release_dev(struct file * filp) { 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 * filp) 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 * filp) #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); |
