mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Holler <holler@ahsoftware.de>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Holler <holler@ahsoftware.de>,
	Peter Hurley <peter@hurleysoftware.com>,
	Jiri Slaby <jslaby@suse.cz>, <stable@vger.kernel.org>
Subject: [PATCH] tty: make sure a BUG is hit if tty_port will be destroyed before tty
Date: Fri, 17 May 2013 09:12:08 +0200	[thread overview]
Message-ID: <1368774728-4817-1-git-send-email-holler@ahsoftware.de> (raw)
In-Reply-To: <5195B561.3090503@ahsoftware.de>

tty depends on tty_port until tty_release() was called. Make sure a BUG
will be hit, if tty_port will be destroyed before tty.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: <stable@vger.kernel.org>
---

 Currently things are changing fast in the tty subsystem, therefor I don't
 know if the patch should be applied to kernel 3.10 too because the
 reference to tty_port in tty_ldisc_halt() is gone in 3.10-rc1.

 So it might be a patch only for the stable kernels since commit
 ecbbfd4 (kernels 3.8 and 3.9).

 drivers/tty/tty_port.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 121aeb9..a40c52b 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -140,6 +140,8 @@ EXPORT_SYMBOL(tty_port_destroy);
 static void tty_port_destructor(struct kref *kref)
 {
 	struct tty_port *port = container_of(kref, struct tty_port, kref);
+	/* tty_port has to live until tty_release() was called. */
+	BUG_ON(port->itty);
 	if (port->xmit_buf)
 		free_page((unsigned long)port->xmit_buf);
 	tty_port_destroy(port);
-- 
1.8.1.4


  reply	other threads:[~2013-05-17  7:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16  6:45 BUG: tty: memory corruption through tty_release/tty_ldisc_release Alexander Holler
2013-05-16 13:15 ` Alexander Holler
2013-05-16 13:47 ` Peter Hurley
2013-05-16 13:59   ` Alexander Holler
2013-05-16 21:53     ` Peter Hurley
2013-05-17  4:43       ` Alexander Holler
2013-05-17  7:12         ` Alexander Holler [this message]
2013-05-17 15:31           ` [PATCH] tty: make sure a BUG is hit if tty_port will be destroyed before tty Greg Kroah-Hartman
2013-05-17 16:41             ` Alexander Holler
2013-05-17 18:06               ` Peter Hurley
2013-05-17 19:22                 ` Alexander Holler
2013-05-17 19:43                   ` Alexander Holler
2013-05-17 22:51                     ` Peter Hurley
2013-05-17 23:41                       ` Alexander Holler
2013-06-25 14:18         ` BUG: tty: memory corruption through tty_release/tty_ldisc_release Dean Jenkins
2013-06-26  7:23           ` Alexander Holler

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=1368774728-4817-1-git-send-email-holler@ahsoftware.de \
    --to=holler@ahsoftware.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=stable@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

all inboxes | Powered by JetHome®