lkml.org 
[lkml]   [2009]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] TTY: pty, lookup retval fixup
Date
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@gmail.com>
---
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


\
 
 \ /
  Last update: 2009-02-01 23:47    [W:0.026 / U:1.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site