lkml.org 
[lkml]   [2013]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] tty: make sure a BUG is hit if tty_port will be destroyed before tty
Date
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


\
 
 \ /
  Last update: 2013-05-17 10:01    [W:0.062 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site