TTY: tty_io, lookup retval fixup
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 <[email protected]>
--- drivers/char/tty_io.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/char/tty_io.c +2 -1
@@ -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;
Signature · 1 line
1.6.1.2
Quoted 5 lines · On Sun, 1 Feb 2009 22:39:16 +0100 Jiri Slaby <[email protected]> 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 byIS_ERR()in__tty_open.
Better to fix any broken functions I think
PATCH 1/1 TTY: pty, lookup retval fixup
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 <[email protected]>
--- drivers/char/pty.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/pty.c +1 -1
@@ -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 ); }/**
Signature · 1 line
1.6.1.2