diff options
author | neel <neel@FreeBSD.org> | 2014-10-08 15:39:24 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-10-08 15:39:24 +0000 |
commit | 66d52c2ef03748bdbfbeaba686e6e296eb0337ba (patch) | |
tree | 274460dbd5d6e308d80cd598dfb9c96f8c9bbf80 | |
parent | 2dd522bc557398a897ed8be949e0f7d9055ca0f1 (diff) | |
download | FreeBSD-src-66d52c2ef03748bdbfbeaba686e6e296eb0337ba.zip FreeBSD-src-66d52c2ef03748bdbfbeaba686e6e296eb0337ba.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.
Approved by: re (glebius)
-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 |