Commit 48ca6da8 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Russell King

[PATCH] small tty irq race fix

parent 5d8a45ef
......@@ -1944,26 +1944,24 @@ static void flush_to_ldisc(void *private_)
schedule_delayed_work(&tty->flip.work, 1);
return;
}
spin_lock_irqsave(&tty->read_lock, flags);
if (tty->flip.buf_num) {
cp = tty->flip.char_buf + TTY_FLIPBUF_SIZE;
fp = tty->flip.flag_buf + TTY_FLIPBUF_SIZE;
tty->flip.buf_num = 0;
local_irq_save(flags); // FIXME: is this safe?
tty->flip.char_buf_ptr = tty->flip.char_buf;
tty->flip.flag_buf_ptr = tty->flip.flag_buf;
} else {
cp = tty->flip.char_buf;
fp = tty->flip.flag_buf;
tty->flip.buf_num = 1;
local_irq_save(flags); // FIXME: is this safe?
tty->flip.char_buf_ptr = tty->flip.char_buf + TTY_FLIPBUF_SIZE;
tty->flip.flag_buf_ptr = tty->flip.flag_buf + TTY_FLIPBUF_SIZE;
}
count = tty->flip.count;
tty->flip.count = 0;
local_irq_restore(flags); // FIXME: is this safe?
spin_unlock_irqrestore(&tty->read_lock, flags);
tty->ldisc.receive_buf(tty, cp, fp, count);
}
......
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