mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] TTY: tty_io, lookup retval fixup
@ 2009-02-01 21:39 Jiri Slaby
  2009-02-01 23:09 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2009-02-01 21:39 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel, Jiri Slaby

Make sure we fail on NULL return value possibly returned by pty
master lookup.

Convert NULL to ERR_PTR(-ENODEV), since NULL is not captured by
IS_ERR() in __tty_open.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/char/tty_io.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index ff92099..2c14dd8 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1217,7 +1217,8 @@ static struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver,
 	struct tty_struct *tty;
 
 	if (driver->ops->lookup)
-		return driver->ops->lookup(driver, inode, idx);
+		return driver->ops->lookup(driver, inode, idx) ? :
+			ERR_PTR(-ENODEV);
 
 	tty = driver->ttys[idx];
 	return tty;
-- 
1.6.1.2


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

end of thread, other threads:[~2009-02-01 22:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-01 21:39 [PATCH 1/1] TTY: tty_io, lookup retval fixup Jiri Slaby
2009-02-01 23:09 ` Alan Cox
2009-02-01 22:43   ` [PATCH 1/1] TTY: pty, " Jiri Slaby

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®