From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org,
Sasha Levin <levinsasha928@gmail.com>,
linux-serial@vger.kernel.org,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 2/5] tty: Fix spinlock flavor in non-atomic __tty_hangup()
Date: Wed, 6 Mar 2013 07:20:54 -0500 [thread overview]
Message-ID: <1362572457-29993-3-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1362572457-29993-1-git-send-email-peter@hurleysoftware.com>
__tty_hangup() and tty_vhangup() cannot be called from atomic context,
so locks do not need to preserve the interrupt state (although,
still disable interrupts).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/tty_io.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index e454f1a..f9d4acf 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -605,7 +605,6 @@ static void __tty_hangup(struct tty_struct *tty)
struct file *filp, *f = NULL;
struct tty_file_private *priv;
int closecount = 0, n;
- unsigned long flags;
int refs;
if (!tty)
@@ -654,7 +653,7 @@ static void __tty_hangup(struct tty_struct *tty)
while (refs--)
tty_kref_put(tty);
- spin_lock_irqsave(&tty->ctrl_lock, flags);
+ spin_lock_irq(&tty->ctrl_lock);
clear_bit(TTY_THROTTLED, &tty->flags);
clear_bit(TTY_PUSH, &tty->flags);
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
@@ -663,7 +662,7 @@ static void __tty_hangup(struct tty_struct *tty)
tty->session = NULL;
tty->pgrp = NULL;
tty->ctrl_status = 0;
- spin_unlock_irqrestore(&tty->ctrl_lock, flags);
+ spin_unlock_irq(&tty->ctrl_lock);
/*
* If one of the devices matches a console pointer, we
--
1.8.1.2
next prev parent reply other threads:[~2013-03-06 12:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 12:20 [PATCH 0/5] Fix session leader exit hang Peter Hurley
2013-03-06 12:20 ` [PATCH 1/5] tty: Refactor session leader SIGHUP from __tty_hangup() Peter Hurley
2013-03-06 12:20 ` Peter Hurley [this message]
2013-03-06 12:20 ` [PATCH 3/5] tty: Use spin_lock() inside existing critical region Peter Hurley
2013-03-06 12:20 ` [PATCH 4/5] tty: Signal foreground group processes in hangup Peter Hurley
2013-03-06 12:20 ` [PATCH 5/5] tty: Signal SIGHUP before hanging up ldisc Peter Hurley
2013-03-06 16:20 ` [PATCH 0/5] Fix session leader exit hang 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=1362572457-29993-3-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=levinsasha928@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).