um: fix oopsable race in line_close()
tty->count is decremented only after ->close() had been called and several tasks can hit it in parallel. As the result, using tty->count to check if you are the last one is broken. We end up leaving line->tty not reset to NULL and the next IRQ on that sucker will blow up trying to dereference pointers from kfree'd struct tty. Fix is obvious: we need to use a counter of our own. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -33,6 +33,7 @@ struct line_driver {
|
||||
struct line {
|
||||
struct tty_struct *tty;
|
||||
spinlock_t count_lock;
|
||||
unsigned long count;
|
||||
int valid;
|
||||
|
||||
char *init_str;
|
||||
|
Reference in New Issue
Block a user