[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1233524356-10994-1-git-send-email-jirislaby@gmail.com>
Date:	Sun,  1 Feb 2009 22:39:16 +0100
From:	Jiri Slaby <jirislaby@...il.com>
To:	alan@...rguk.ukuu.org.uk
Cc:	linux-kernel@...r.kernel.org, Jiri Slaby <jirislaby@...il.com>
Subject: [PATCH 1/1] TTY: tty_io, lookup retval fixup
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@...il.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
--
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
 
