Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305835

[PATCH v2 3/9] ia64: Pin controlling tty for unaligned fault message

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/9] ia64: Pin controlling tty for unaligned fault message
Date 2016-01-11 05:40 +0100
Message-ID <qPCqU-5KZ-51@gated-at.bofh.it> (permalink)
References <qPCqS-5KZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/9] Misc tty fixes & cleanups Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 5/9] tty: Fix GPF in flush_to_ldisc(), part 2 Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 9/9] tty: Use test_bit() with tty->flags Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 1/9] tty: rocket: Remove private close_wait Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 6/9] tty: Unify receive_buf() code paths Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 3/9] ia64: Pin controlling tty for unaligned fault message Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 8/9] tty: Use termios c_*flag macros Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100
  [PATCH v2 2/9] n_tty: Ignore all read data when closing Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:40 +0100

csiph-web