[PATCH] Fix nobh_prepare_write() race
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.
Showing
Please register or sign in to comment