Commit 16ca3698 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] fix for do_tty_hangup() access of kfreed memory

	do_tty_hangup() does fput() on redirect struct file too early -
it could've been the only holder of tty_struct we are working with and in
that case we'll end up freeing it from fput() and then both reading and
modifying kfreed memory.
parent 95c2f4d9
......@@ -423,8 +423,6 @@ void do_tty_hangup(void *data)
redirect = NULL;
}
spin_unlock(&redirect_lock);
if (f)
fput(f);
check_tty_count(tty, "do_tty_hangup");
file_list_lock();
......@@ -512,6 +510,8 @@ void do_tty_hangup(void *data)
} else if (tty->driver->hangup)
(tty->driver->hangup)(tty);
unlock_kernel();
if (f)
fput(f);
}
void tty_hangup(struct tty_struct * tty)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment