All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add missing rcu_read_lock for task_pgrp.
@ 2015-06-27 21:17 Patrick Donnelly
  2015-06-27 21:17 ` [PATCH 2/2] Check tcsetpgrp p is a process group Patrick Donnelly
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Patrick Donnelly @ 2015-06-27 21:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, open list; +Cc: Patrick Donnelly

Signed-off-by: Patrick Donnelly <batrick@batbytes.com>
---
 drivers/tty/tty_io.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 57fc6ee..401d05e 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -388,33 +388,40 @@ EXPORT_SYMBOL_GPL(tty_find_polling_driver);
 int tty_check_change(struct tty_struct *tty)
 {
 	unsigned long flags;
+	struct pid *pgrp;
 	int ret = 0;
 
 	if (current->signal->tty != tty)
 		return 0;
 
-	spin_lock_irqsave(&tty->ctrl_lock, flags);
+	rcu_read_lock();
+	pgrp = task_pgrp(current);
 
+	spin_lock_irqsave(&tty->ctrl_lock, flags);
 	if (!tty->pgrp) {
 		printk(KERN_WARNING "tty_check_change: tty->pgrp == NULL!\n");
-		goto out_unlock;
+		goto out_irqunlock;
 	}
-	if (task_pgrp(current) == tty->pgrp)
-		goto out_unlock;
 	spin_unlock_irqrestore(&tty->ctrl_lock, flags);
+
+	if (pgrp == tty->pgrp)
+		goto out_rcuunlock;
 	if (is_ignored(SIGTTOU))
 		goto out;
 	if (is_current_pgrp_orphaned()) {
 		ret = -EIO;
 		goto out;
 	}
-	kill_pgrp(task_pgrp(current), SIGTTOU, 1);
+	kill_pgrp(pgrp, SIGTTOU, 1);
+	rcu_read_unlock();
 	set_thread_flag(TIF_SIGPENDING);
 	ret = -ERESTARTSYS;
 out:
 	return ret;
-out_unlock:
+out_irqunlock:
 	spin_unlock_irqrestore(&tty->ctrl_lock, flags);
+out_rcuunlock:
+	rcu_read_unlock();
 	return ret;
 }
 
-- 
Patrick Donnelly


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-07-20 19:42 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-27 21:17 [PATCH 1/2] Add missing rcu_read_lock for task_pgrp Patrick Donnelly
2015-06-27 21:17 ` [PATCH 2/2] Check tcsetpgrp p is a process group Patrick Donnelly
2015-06-27 23:26   ` Greg Kroah-Hartman
2015-06-28  0:53     ` Patrick Donnelly
2015-06-27 23:27   ` Greg Kroah-Hartman
2015-06-27 23:25 ` [PATCH 1/2] Add missing rcu_read_lock for task_pgrp Greg Kroah-Hartman
2015-06-28  0:51 ` [PATCH v2 1/2] tty: add " Patrick Donnelly
2015-06-28  0:51   ` [PATCH v2 2/2] tty: check tcsetpgrp p is a process group Patrick Donnelly
2015-06-28 16:07     ` Peter Hurley
2015-06-29  1:27       ` Patrick Donnelly
2015-06-28 15:23   ` [PATCH v2 1/2] tty: add missing rcu_read_lock for task_pgrp Peter Hurley
2015-06-28 17:20     ` Patrick Donnelly
2015-06-28 19:21       ` Peter Hurley
2015-06-28 19:27   ` Peter Hurley
2015-06-29 23:38     ` Patrick Donnelly
2015-06-29 23:59 ` [PATCH v3] " Patrick Donnelly
2015-07-09  2:07   ` Peter Hurley
2015-07-12  2:05   ` Peter Hurley
2015-07-12 22:42     ` Patrick Donnelly
2015-07-12 22:51 ` [PATCH v4] " Patrick Donnelly
2015-07-13  0:35   ` Peter Hurley
2015-07-20  9:26   ` Jiri Slaby
2015-07-20 19:40     ` Oleg Nesterov

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.