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

From: Jiri Slaby
Date: Sun Feb 01 2009 - 17:44:07 EST


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

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

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

diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 31038a0..261223b 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -508,7 +508,7 @@ static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver,
struct tty_struct *tty = devpts_get_tty(ptm_inode, idx);
if (tty)
tty = tty->link;
- return tty;
+ return tty ? : ERR_PTR(-ENODEV);
}

/**
--
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/