# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Node ID 747aaae397bf895210cf29ee7f95d03ea29888ef # Parent 8e55c5c1147589b7a6a1875384d4317aec7ccf84 xenconsole fix. reference of tty->count in xencons_close() is racy. It must be protected by tty_sem semaphore like con_close() in drivers/char/vt.c. and prevent re-opening this tty. PATCHNAME: add_tty_sem Signed-off-by: Isaku Yamahata diff -r 8e55c5c11475 -r 747aaae397bf linux-2.6-xen-sparse/drivers/xen/console/console.c --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Jul 05 18:48:41 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c Sat Jul 08 14:09:02 2006 +0900 @@ -536,7 +536,11 @@ static void xencons_close(struct tty_str if (DUMMY_TTY(tty)) return; + down(&tty_sem); if (tty->count == 1) { + /* prevent other thread re-opening this tty. */ + set_bit(TTY_CLOSING, &tty->flags); + up(&tty_sem); tty->closing = 1; tty_wait_until_sent(tty, 0); if (DRV(tty->driver)->flush_buffer != NULL) @@ -547,7 +551,8 @@ static void xencons_close(struct tty_str spin_lock_irqsave(&xencons_lock, flags); xencons_tty = NULL; spin_unlock_irqrestore(&xencons_lock, flags); - } + } else + up(&tty_sem); } static struct tty_operations xencons_ops = {