Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54611
b: refs/heads/master
c: 98a27ba
h: refs/heads/master
i:
  54609: 686e7f6
  54607: 819631e
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed May 8, 2007
1 parent 77e795e commit 0e2531d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2a65f1d9fe78475720bd8f0e0fbbf1973b1b5ac2
refs/heads/master: 98a27ba485c7508ef9d9527fe06e4686f3a163dc
19 changes: 15 additions & 4 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ int tty_ioctl(struct inode * inode, struct file * file,
static int tty_fasync(int fd, struct file * filp, int on);
static void release_tty(struct tty_struct *tty, int idx);
static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);

/**
* alloc_tty_struct - allocate a tty object
Expand Down Expand Up @@ -1558,6 +1559,18 @@ void disassociate_ctty(int on_exit)
unlock_kernel();
}

/**
*
* no_tty - Ensure the current process does not have a controlling tty
*/
void no_tty(void)
{
struct task_struct *tsk = current;
if (tsk->signal->leader)
disassociate_ctty(0);
proc_clear_tty(tsk);
}


/**
* stop_tty - propogate flow control
Expand Down Expand Up @@ -3280,9 +3293,7 @@ int tty_ioctl(struct inode * inode, struct file * file,
case TIOCNOTTY:
if (current->signal->tty != tty)
return -ENOTTY;
if (current->signal->leader)
disassociate_ctty(0);
proc_clear_tty(current);
no_tty();
return 0;
case TIOCSCTTY:
return tiocsctty(tty, arg);
Expand Down Expand Up @@ -3844,7 +3855,7 @@ static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
tsk->signal->tty_old_pgrp = NULL;
}

void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
{
spin_lock_irq(&tsk->sighand->siglock);
__proc_set_tty(tsk, tty);
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ extern int tty_hung_up_p(struct file * filp);
extern void do_SAK(struct tty_struct *tty);
extern void __do_SAK(struct tty_struct *tty);
extern void disassociate_ctty(int priv);
extern void no_tty(void);
extern void tty_flip_buffer_push(struct tty_struct *tty);
extern speed_t tty_get_baud_rate(struct tty_struct *tty);
extern speed_t tty_termios_baud_rate(struct ktermios *termios);
Expand All @@ -333,7 +334,6 @@ extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd,

extern dev_t tty_devnum(struct tty_struct *tty);
extern void proc_clear_tty(struct task_struct *p);
extern void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
extern struct tty_struct *get_current_tty(void);

extern struct mutex tty_mutex;
Expand Down
7 changes: 3 additions & 4 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,12 +1758,11 @@ static inline void flush_unauthorized_files(struct files_struct * files)
}
}
file_list_unlock();

/* Reset controlling tty. */
if (drop_tty)
proc_set_tty(current, NULL);
}
mutex_unlock(&tty_mutex);
/* Reset controlling tty. */
if (drop_tty)
no_tty();

/* Revalidate access to inherited open files. */

Expand Down

0 comments on commit 0e2531d

Please sign in to comment.