• Ryan S. Arnold's avatar
    [PATCH] hvc_console fix to prevent oops and late hangup and write operations · d4eca0f0
    Ryan S. Arnold authored
    This patch prevents execution of hvc_write() and hvc_hangup() after the tty
    layer has executed a final hvc_close() against a device.  This patch
    provides a better method than was previously used.  tty->driver_data is no
    longer invalidated so we'll no longer get oopses when the tty layer allows
    late hangup() and write() operations.
    
    - Removed silly tty->driver_data = NULL; from hvc_close which prevents
      possible oops in hvc_write() and hvc_hangup() due to improperly acting
      ldisc close ordering.
    
    - Added hp->count <= 0 check to hvc_write() and hvc_hangup() to prevent
      execution of these function after hvc_close() has been invoked by the tty
      layer.  Same tty ldisc issues as above are the reason.
    
    - Added some comments to clarify the situation.
    
    - Awaiting a forth coming patch from Alan Cox which should clean up the
      close ordering and prevent the late hangup and write ops from happening.
    Signed-off-by: default avatarRyan S. Arnold <rsa@us.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    d4eca0f0
hvc_console.c 20.9 KB