summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-10-08 04:35:09 +0000
committerneel <neel@FreeBSD.org>2014-10-08 04:35:09 +0000
commita70300211f57854c523447d8b27d3f58ce5db043 (patch)
tree2f892be947175fee5fecf4e08e83e5b76dc27914 /sys/kern/tty.c
parent50b9567d083f3e46c97e8166976be6e3bb126d0f (diff)
downloadFreeBSD-src-a70300211f57854c523447d8b27d3f58ce5db043.zip
FreeBSD-src-a70300211f57854c523447d8b27d3f58ce5db043.tar.gz
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.
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c12
1 files 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
OpenPOWER on IntegriCloud