• Andrew Morton's avatar
    [PATCH] drivers/char/vt possible race · ce8b13c9
    Andrew Morton authored
    From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    
    I falled again on the crash in con_do_write() with driver->data beeing
    NULL.  It happens during boot, when userland is playing open/close games
    with tty's, I was intentionally typing keys like mad during boot trying to
    trigger another problem when this one poped up.
    
    Looking at the code, I'm not sure how protected we are by the above (tty)
    layer, paulus told me to not rely on anything like locking coming from
    there, so I decided to extend the scope of the console semaphore one more
    bit to cover races between calls to con_open, con_close and con_write.
    Note that in con_do_write, I intentionally drop the semaphore to avoid
    keeping it held when waiting on the local buffer, and I added some sanity
    checks on tty->driver_data with some printk's in case we still have an open
    race by the tty layer.  At least, now, the couple vc_allocated &
    tty->driver_data should be protected though.
    ce8b13c9
vt.c 72.2 KB