lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Mar 2010 17:20:37 +0000
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Pavan Savoy <pavan_savoy@...oo.co.in>
Cc:	Greg KH <gregkh@...e.de>, Marcel Holtmann <marcel@...tmann.org>,
	PavanSavoy <pavan_savoy@...com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/6] drivers:misc: sources for Init manager module

> Alan's talking about opening up the LDISC installation to kernel (say EXPORTING tty_set_ldisc/tiocsetd), That's like ideal scenario in this case.

Ok I lied - its four lines of code changing, and just set

	.ldisc = N_whatever

in your tty_driver

Marcel - that should also clean up some of the other pending goodies

[Untested Patch]

--

tty: Allow the driver to force an ldisc on open

From: Alan Cox <alan@...ux.intel.com>

We need this because some hardware is always in various mux or control
modes. At the moment we do handstands via userspace to sort this out on
devices where it makes no sense. Given the size of the patch to fix this
inanity we might as well do so.

Signed-off-by: Alan Cox <alan@...ux.intel.com>
---

 drivers/char/tty_ldisc.c   |    6 +++---
 include/linux/tty_driver.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 500e740..b149f9c 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -863,8 +863,8 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
 	/* Force an oops if we mess this up */
 	tty->ldisc = NULL;
 
-	/* Ensure the next open requests the N_TTY ldisc */
-	tty_set_termios_ldisc(tty, N_TTY);
+	/* Ensure the next open requests the expected (usually N_TTY) ldisc */
+	tty_set_termios_ldisc(tty, tty->driver->ldisc);
 	mutex_unlock(&tty->ldisc_mutex);
 
 	/* This will need doing differently if we need to lock */
@@ -885,7 +885,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
 
 void tty_ldisc_init(struct tty_struct *tty)
 {
-	struct tty_ldisc *ld = tty_ldisc_get(N_TTY);
+	struct tty_ldisc *ld = tty_ldisc_get(tty->driver->ldisc);
 	if (IS_ERR(ld))
 		panic("n_tty: init_tty");
 	tty_ldisc_assign(tty, ld);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b086779..fc22a41 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -291,6 +291,7 @@ struct tty_driver {
 	short	type;		/* type of tty driver */
 	short	subtype;	/* subtype of tty driver */
 	struct ktermios init_termios; /* Initial termios */
+	int	ldisc;		/* initial ldisc */
 	int	flags;		/* tty driver flags */
 	struct proc_dir_entry *proc_entry; /* /proc fs entry */
 	struct tty_driver *other; /* only used for the PTY driver */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ