All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Zykov <ilya@ilyx.ru>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jiri Slaby <jslaby@suse.cz>, Alan Cox <alan@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] TTY: pty, fix pty counting
Date: Sun, 23 Oct 2011 18:42:40 +0400	[thread overview]
Message-ID: <4EA427E0.2080601@ilyx.ru> (raw)

New version for commit: 24d406a6bf736f7aebdc8fa0f0ec86e0890c6d24


diff -uprN a/drivers/tty/pty.c b/drivers/tty/pty.c
--- a/drivers/tty/pty.c    2011-05-19 08:06:34.000000000 +0400
+++ b/drivers/tty/pty.c    2011-10-23 18:01:20.000000000 +0400
@@ -36,13 +36,15 @@
 static struct tty_driver *ptm_driver;
 static struct tty_driver *pts_driver;
 #endif
+static int pty_count;
 
 static void pty_close(struct tty_struct *tty, struct file *filp)
 {
     BUG_ON(!tty);
-    if (tty->driver->subtype == PTY_TYPE_MASTER)
+    if (tty->driver->subtype == PTY_TYPE_MASTER) {
         WARN_ON(tty->count > 1);
-    else {
+        pty_count--;
+    } else {
         if (tty->count > 2)
             return;
     }
@@ -446,7 +448,6 @@ static inline void legacy_pty_init(void)
 int pty_limit = NR_UNIX98_PTY_DEFAULT;
 static int pty_limit_min;
 static int pty_limit_max = NR_UNIX98_PTY_MAX;
-static int pty_count;
 
 static struct cdev ptmx_cdev;
 
@@ -599,15 +600,9 @@ free_mem_out:
     return -ENOMEM;
 }
 
-static void pty_unix98_remove(struct tty_driver *driver, struct 
tty_struct *tty)
-{
-    pty_count--;
-}
-
 static const struct tty_operations ptm_unix98_ops = {
     .lookup = ptm_unix98_lookup,
     .install = pty_unix98_install,
-    .remove = pty_unix98_remove,
     .open = pty_open,
     .close = pty_close,
     .write = pty_write,
@@ -624,7 +619,6 @@ static const struct tty_operations ptm_u
 static const struct tty_operations pty_unix98_ops = {
     .lookup = pts_unix98_lookup,
     .install = pty_unix98_install,
-    .remove = pty_unix98_remove,
     .open = pty_open,
     .close = pty_close,
     .write = pty_write,




             reply	other threads:[~2011-10-23 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-23 14:42 Ilya Zykov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-23 21:01 [PATCH] TTY: pty, fix pty counting Ilya Zykov
2011-10-24 13:11 ` Jiri Slaby
2011-10-24 14:33   ` Ilya Zykov
2011-10-24 14:50   ` Ilya Zykov

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=4EA427E0.2080601@ilyx.ru \
    --to=ilya@ilyx.ru \
    --cc=alan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=jslaby@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.