From: "Vladimir B. Savkin" <master@sectorb.msk.ru>
To: linux-kernel@vger.kernel.org
Subject: UNIX98 pty indices leak
Date: Wed, 21 Jul 2004 18:45:47 +0400 [thread overview]
Message-ID: <20040721144546.GA9740@tentacle.sectorb.msk.ru> (raw)
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.
reply other threads:[~2004-07-21 14:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040721144546.GA9740@tentacle.sectorb.msk.ru \
--to=master@sectorb.msk.ru \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).