The mutex used for locking the TTY also doubles as the lock for the
TTY's knlist. This becomes problematic since knlist_clear() will detach
knotes from the knlist and results in the TTY filterops being called
without locking the TTY.
To workaround this, do not clear knotes when the TTY is still active,
unless the TTY is being revoked - in that case, delete them. When a TTY
is being freed, the knotes are removed as usual.
PR: 272151