• Andrew Morton's avatar
    [PATCH] Fix nobh_prepare_write() race · b12088bf
    Andrew Morton authored
    Dave Kleikamp <shaggy@austin.ibm.com> points out a race between
    nobh_prepare_write() and end_buffer_read_sync().  end_buffer_read_sync()
    calls unlock_buffer(), waking the nobh_prepare_write() thread, which
    immediately frees the buffer_head.  end_buffer_read_sync() then calls
    put_bh() which decrements b_count for the already freed structure.  The
    SLAB_DEBUG code detects the slab corruption.
    
    We fix this by giving nobh_prepare_write() a private buffer_head end_o
    handler which doesn't touch the buffer's contents after unlocking it.
    b12088bf
buffer.c 79.7 KB