mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Series short description
@ 2008-12-01 11:35 Alan Cox
  2008-12-01 11:36 ` [PATCH 1/2] drivers/char/tty_io.c: Avoid panic when no console is configured Alan Cox
  2008-12-01 11:36 ` [PATCH 2/2] Add kref to fake tty used by USB console Alan Cox
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Cox @ 2008-12-01 11:35 UTC (permalink / raw)
  To: torvalds, linux-kernel

A pair of small fixes for nasty console related bugs from the various tty
merges and updates.

Alan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] drivers/char/tty_io.c: Avoid panic when no console is configured.
  2008-12-01 11:35 [PATCH 0/2] Series short description Alan Cox
@ 2008-12-01 11:36 ` Alan Cox
  2008-12-01 11:36 ` [PATCH 2/2] Add kref to fake tty used by USB console Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2008-12-01 11:36 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: \"Will Newton\" <will.newton@gmail.com>

When no console is configured tty_open tries to call kref_get on a NULL
pointer, return ENODEV instead.

Signed-off-by: Will Newton <will.newton@gmail.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/char/tty_io.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)


diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 966be86..ac73fd9 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1793,12 +1793,15 @@ retry_open:
 	}
 #endif
 	if (device == MKDEV(TTYAUX_MAJOR, 1)) {
-		driver = tty_driver_kref_get(console_device(&index));
-		if (driver) {
-			/* Don't let /dev/console block */
-			filp->f_flags |= O_NONBLOCK;
-			noctty = 1;
-			goto got_driver;
+		struct tty_driver *console_driver = console_device(&index);
+		if (console_driver) {
+			driver = tty_driver_kref_get(console_driver);
+			if (driver) {
+				/* Don't let /dev/console block */
+				filp->f_flags |= O_NONBLOCK;
+				noctty = 1;
+				goto got_driver;
+			}
 		}
 		mutex_unlock(&tty_mutex);
 		return -ENODEV;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Add kref to fake tty used by USB console
  2008-12-01 11:35 [PATCH 0/2] Series short description Alan Cox
  2008-12-01 11:36 ` [PATCH 1/2] drivers/char/tty_io.c: Avoid panic when no console is configured Alan Cox
@ 2008-12-01 11:36 ` Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2008-12-01 11:36 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Kevin Hao <kexin.hao@windriver.com>

We alloc a fake tty in usb serial console setup function. we should
init the tty's kref otherwise we will face WARN_ON after following
invoke of tty_port_tty_set --> tty_kref_get.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/usb/serial/console.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 5b20de1..5b95009 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -135,6 +135,7 @@ static int usb_console_setup(struct console *co, char *options)
 				err("no more memory");
 				goto reset_open_count;
 			}
+			kref_init(&tty->kref);
 			termios = kzalloc(sizeof(*termios), GFP_KERNEL);
 			if (!termios) {
 				retval = -ENOMEM;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-01 11:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-01 11:35 [PATCH 0/2] Series short description Alan Cox
2008-12-01 11:36 ` [PATCH 1/2] drivers/char/tty_io.c: Avoid panic when no console is configured Alan Cox
2008-12-01 11:36 ` [PATCH 2/2] Add kref to fake tty used by USB console Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome