Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: Remove tsk parameter from proc_set_tty()

Only the current task itself can set its controlling tty (other
than before the task has been forked). Equivalent to existing usage.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Hurley and committed by
Greg Kroah-Hartman
bce65f18 11d9befd

+14 -14
+14 -14
drivers/tty/tty_io.c
··· 504 504 505 505 /* Called under the sighand lock */ 506 506 507 - static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty) 507 + static void __proc_set_tty(struct tty_struct *tty) 508 508 { 509 509 if (tty) { 510 510 unsigned long flags; ··· 512 512 spin_lock_irqsave(&tty->ctrl_lock, flags); 513 513 put_pid(tty->session); 514 514 put_pid(tty->pgrp); 515 - tty->pgrp = get_pid(task_pgrp(tsk)); 515 + tty->pgrp = get_pid(task_pgrp(current)); 516 516 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 517 - tty->session = get_pid(task_session(tsk)); 518 - if (tsk->signal->tty) { 517 + tty->session = get_pid(task_session(current)); 518 + if (current->signal->tty) { 519 519 printk(KERN_DEBUG "tty not NULL!!\n"); 520 - tty_kref_put(tsk->signal->tty); 520 + tty_kref_put(current->signal->tty); 521 521 } 522 522 } 523 - put_pid(tsk->signal->tty_old_pgrp); 524 - tsk->signal->tty = tty_kref_get(tty); 525 - tsk->signal->tty_old_pgrp = NULL; 523 + put_pid(current->signal->tty_old_pgrp); 524 + current->signal->tty = tty_kref_get(tty); 525 + current->signal->tty_old_pgrp = NULL; 526 526 } 527 527 528 - static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty) 528 + static void proc_set_tty(struct tty_struct *tty) 529 529 { 530 - spin_lock_irq(&tsk->sighand->siglock); 531 - __proc_set_tty(tsk, tty); 532 - spin_unlock_irq(&tsk->sighand->siglock); 530 + spin_lock_irq(&current->sighand->siglock); 531 + __proc_set_tty(tty); 532 + spin_unlock_irq(&current->sighand->siglock); 533 533 } 534 534 535 535 struct tty_struct *get_current_tty(void) ··· 2156 2156 current->signal->leader && 2157 2157 !current->signal->tty && 2158 2158 tty->session == NULL) 2159 - __proc_set_tty(current, tty); 2159 + __proc_set_tty(tty); 2160 2160 spin_unlock_irq(&current->sighand->siglock); 2161 2161 tty_unlock(tty); 2162 2162 mutex_unlock(&tty_mutex); ··· 2482 2482 goto unlock; 2483 2483 } 2484 2484 } 2485 - proc_set_tty(current, tty); 2485 + proc_set_tty(tty); 2486 2486 unlock: 2487 2487 mutex_unlock(&tty_mutex); 2488 2488 return ret;