From ffaf07f92f50a6509537c0b55c782acf0c692fea Mon Sep 17 00:00:00 2001 From: neel Date: Wed, 8 Oct 2014 04:35:09 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.freebsd.org/base/stable/10@272726 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- 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 b3968c586..333378c9d 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 -- 2.45.0