* [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
* [PATCH 1/1] TTY: pty, lookup retval fixup
2009-02-01 23:09 ` Alan Cox
@ 2009-02-01 22:43 ` Jiri Slaby
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-02-01 22:43 UTC (permalink / raw)
To: alan; +Cc: linux-kernel, Jiri Slaby
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] TTY: tty_io, lookup retval fixup
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
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2009-02-01 23:09 UTC (permalink / raw)
To: Jiri Slaby, linux-kernel
On Sun, 1 Feb 2009 22:39:16 +0100
Jiri Slaby <jirislaby@gmail.com> wrote:
> 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.
Better to fix any broken functions I think
^ 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®