From a70300211f57854c523447d8b27d3f58ce5db043 Mon Sep 17 00:00:00 2001 From: neel Date: Wed, 8 Oct 2014 04:35:09 +0000 Subject: MFC r272270: tty_rel_free() can be called more than once for the same tty so make sure that the tty is dequeued from 'tty_list' only the first time. --- sys/kern/tty.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b3968c5..333378c 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1055,13 +1055,13 @@ tty_rel_free(struct tty *tp) tp->t_dev = NULL; tty_unlock(tp); - sx_xlock(&tty_list_sx); - TAILQ_REMOVE(&tty_list, tp, t_list); - tty_list_count--; - sx_xunlock(&tty_list_sx); - - if (dev != NULL) + if (dev != NULL) { + sx_xlock(&tty_list_sx); + TAILQ_REMOVE(&tty_list, tp, t_list); + tty_list_count--; + sx_xunlock(&tty_list_sx); destroy_dev_sched_cb(dev, tty_dealloc, tp); + } } void -- cgit v1.1