From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>,
Dan Carpenter <dan.carpenter@oracle.com>,
julia.lawall@lip6.fr
Cc: linux-kernel@vger.kernel.org,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH] drivers: tty: Fix use-after-free in pty_common_install
Date: Sun, 13 Jul 2014 01:44:00 +0200 [thread overview]
Message-ID: <1405208640-3613-1-git-send-email-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20140712164714.GA12148@kroah.com>
In 2c964a2f "drivers: tty: Merge alloc_tty_struct and
initialize_tty_struct", I messed up the refactorization of
pty_common_install, causing use-after-free and NULL pointer derefs on
various error paths. This should fix it.
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/tty/pty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index ac723e3..9bbdb1d 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -388,7 +388,7 @@ err_deinit_tty:
deinitialize_tty_struct(o_tty);
free_tty_struct(o_tty);
err_put_module:
- module_put(o_tty->driver->owner);
+ module_put(driver->other->owner);
err:
kfree(ports[0]);
kfree(ports[1]);
--
1.9.2
prev parent reply other threads:[~2014-07-12 23:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 16:16 [PATCH] drivers: tty: Remove redundant memset() in initialize_tty_struct Rasmus Villemoes
2014-07-10 16:22 ` Jiri Slaby
2014-07-10 19:01 ` [PATCH] drivers: tty: Merge alloc_tty_struct and initialize_tty_struct Rasmus Villemoes
2014-07-12 10:55 ` [PATCH v2] " Rasmus Villemoes
2014-07-12 12:16 ` Dan Carpenter
2014-07-12 16:47 ` Greg Kroah-Hartman
2014-07-12 23:44 ` Rasmus Villemoes [this message]
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=1405208640-3613-1-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=julia.lawall@lip6.fr \
--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®