mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>
Subject: [PATCH 1/1] TTY: tty_io, lookup retval fixup
Date: Sun,  1 Feb 2009 22:39:16 +0100	[thread overview]
Message-ID: <1233524356-10994-1-git-send-email-jirislaby@gmail.com> (raw)

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


             reply	other threads:[~2009-02-01 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-01 21:39 Jiri Slaby [this message]
2009-02-01 23:09 ` Alan Cox
2009-02-01 22:43   ` [PATCH 1/1] TTY: pty, " Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233524356-10994-1-git-send-email-jirislaby@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®