um: Use tty_port in SIGWINCH handler

The tty below tty_port might get destroyed by the tty layer
while we hold a reference to it.
So we have to carry tty_port around...

Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Richard Weinberger
2013-03-11 10:05:45 +01:00
parent cc4f02486c
commit 2116bda6ad
5 changed files with 22 additions and 18 deletions

View File

@@ -216,7 +216,7 @@ static int winch_thread(void *arg)
}
}
static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out,
static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
unsigned long *stack_out)
{
struct winch_data data;
@@ -271,7 +271,7 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out,
return err;
}
void register_winch(int fd, struct tty_struct *tty)
void register_winch(int fd, struct tty_port *port)
{
unsigned long stack;
int pid, thread, count, thread_fd = -1;
@@ -281,17 +281,17 @@ void register_winch(int fd, struct tty_struct *tty)
return;
pid = tcgetpgrp(fd);
if (is_skas_winch(pid, fd, tty)) {
register_winch_irq(-1, fd, -1, tty, 0);
if (is_skas_winch(pid, fd, port)) {
register_winch_irq(-1, fd, -1, port, 0);
return;
}
if (pid == -1) {
thread = winch_tramp(fd, tty, &thread_fd, &stack);
thread = winch_tramp(fd, port, &thread_fd, &stack);
if (thread < 0)
return;
register_winch_irq(thread_fd, fd, thread, tty, stack);
register_winch_irq(thread_fd, fd, thread, port, stack);
count = write(thread_fd, &c, sizeof(c));
if (count != sizeof(c))