Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbbF0VRh (ORCPT ); Sat, 27 Jun 2015 17:17:37 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:38329 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053AbbF0VR3 (ORCPT ); Sat, 27 Jun 2015 17:17:29 -0400 From: Patrick Donnelly To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org (open list) Cc: Patrick Donnelly Subject: [PATCH 1/2] Add missing rcu_read_lock for task_pgrp. Date: Sat, 27 Jun 2015 17:17:02 -0400 Message-Id: <1435439824-3975-1-git-send-email-batrick@batbytes.com> X-Mailer: git-send-email 2.4.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1639 Lines: 64 Signed-off-by: Patrick Donnelly --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/