* UNIX98 pty indices leak
@ 2004-07-21 14:45 Vladimir B. Savkin
0 siblings, 0 replies; only message in thread
From: Vladimir B. Savkin @ 2004-07-21 14:45 UTC (permalink / raw)
To: linux-kernel
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-07-21 14:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21 14:45 UNIX98 pty indices leak Vladimir B. Savkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®