Fix a race condition, where a TTY could be destroyed twice.

There are special cases where tty_rel_free() can be called twice in a
row, namely when closing and revoking the TTY at the same moment. Only
call destroy_dev_sched_cb() once.

Reported by:	Jeremie Le Hen
MFC after:	1 week
This commit is contained in:
Ed Schouten 2010-07-06 08:56:34 +00:00
parent 9f9c8c59ae
commit 822eb2b050
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209718

View File

@ -1040,7 +1040,8 @@ tty_rel_free(struct tty *tp)
tp->t_dev = NULL;
tty_unlock(tp);
destroy_dev_sched_cb(dev, tty_dealloc, tp);
if (dev != NULL)
destroy_dev_sched_cb(dev, tty_dealloc, tp);
}
void