diff options
author | neel <neel@FreeBSD.org> | 2014-10-08 04:35:09 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-10-08 04:35:09 +0000 |
commit | a70300211f57854c523447d8b27d3f58ce5db043 (patch) | |
tree | 2f892be947175fee5fecf4e08e83e5b76dc27914 | |
parent | 50b9567d083f3e46c97e8166976be6e3bb126d0f (diff) | |
download | FreeBSD-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.
-rw-r--r-- | sys/kern/tty.c | 12 |
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 |