[PATCH 1/1] TTY: tty_io, lookup retval fixup

From: Jiri Slaby
Date: Sun Feb 01 2009 - 16:40:49 EST


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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/