Without lack of respect for the effort "urggggggggggggggggghhhhhhhh" 8)
Have a look how the tty layer revokes access to things. Instead of putting
another check inline with every fs syscall it changes the read/write/etc
methods for the object to point to ones that return -ENXIO. That then
requires no extra changes although it does have some implicit races - as
does yours. Specifically
begin read
revoke
read wakes up
complete read
next read
-EIO
next read
-EIO
the tty drivers handle the relevant races correctly internally if I am
reading the code right.