• Paul Fulghum's avatar
    [PATCH] tty reference count fix · da965822
    Paul Fulghum authored
    Fix hole where tty structure can be released when reference count is non
    zero.  Existing code can sleep without tty_sem protection between deciding
    to release the tty structure (setting local variables tty_closing and
    otty_closing) and setting TTY_CLOSING to prevent further opens.  An open
    can occur during this interval causing release_dev() to free the tty
    structure while it is still referenced.
    
    This should fix bugzilla.kernel.org [Bug 6041] New: Unable to handle kernel
    paging request
    
    In Bug 6041, tty_open() oopes on accessing the tty structure it has
    successfully claimed.  Bug was on SMP machine with the same tty being
    opened and closed by multiple processes, and DEBUG_PAGEALLOC enabled.
    Signed-off-by: default avatarPaul Fulghum <paulkf@microgate.com>
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Cc: Jesper Juhl <jesper.juhl@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    da965822
tty_io.c 80.5 KB