All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH v2 3/9] ia64: Pin controlling tty for unaligned fault message
Date: Sun, 10 Jan 2016 20:36:10 -0800	[thread overview]
Message-ID: <1452486976-7594-4-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1452486976-7594-1-git-send-email-peter@hurleysoftware.com>

Prevent destruction of the controlling tty before tty_write_message()
can determine if the tty is safe to use.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 arch/ia64/kernel/unaligned.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 622772b..e7ae608 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -1336,8 +1336,11 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
 			 * Don't call tty_write_message() if we're in the kernel; we might
 			 * be holding locks...
 			 */
-			if (user_mode(regs))
-				tty_write_message(current->signal->tty, buf);
+			if (user_mode(regs)) {
+				struct tty_struct *tty = get_current_tty();
+				tty_write_message(tty, buf);
+				tty_kref_put(tty);
+			}
 			buf[len-1] = '\0';	/* drop '\r' */
 			/* watch for command names containing %s */
 			printk(KERN_WARNING "%s", buf);
-- 
2.7.0

  parent reply	other threads:[~2016-01-11  4:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11  4:36 [PATCH v2 0/9] Misc tty fixes & cleanups Peter Hurley
2016-01-11  4:36 ` [PATCH v2 1/9] tty: rocket: Remove private close_wait Peter Hurley
2016-01-11  4:36 ` [PATCH v2 2/9] n_tty: Ignore all read data when closing Peter Hurley
2016-01-11  4:36 ` Peter Hurley [this message]
2016-01-11  4:36 ` [PATCH v2 4/9] staging: dgap: Remove redundant write_wait wakeups Peter Hurley
2016-01-11  4:36 ` [PATCH v2 5/9] tty: Fix GPF in flush_to_ldisc(), part 2 Peter Hurley
2016-01-11  4:36 ` [PATCH v2 6/9] tty: Unify receive_buf() code paths Peter Hurley
2016-01-11  4:36 ` [PATCH v2 7/9] tty: Allow unreadable mess to be > 80 chars Peter Hurley
2016-01-11  4:36 ` [PATCH v2 8/9] tty: Use termios c_*flag macros Peter Hurley
2016-01-19 14:38   ` Johan Hovold
2016-01-11  4:36 ` [PATCH v2 9/9] tty: Use test_bit() with tty->flags Peter Hurley
2016-01-28 22:13   ` Greg Kroah-Hartman
2016-01-28 22:19     ` Peter Hurley
2016-01-28 22:22       ` Greg Kroah-Hartman
2016-04-10  0:06         ` [PATCH] tty: Replace TTY_IO_ERROR bit tests with tty_io_error() Peter Hurley

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=1452486976-7594-4-git-send-email-peter@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.