• Jan Kara's avatar
    reiserfs: Fix use after free in journal teardown · e1c88681
    Jan Kara authored
    commit 01777836 upstream.
    
    If do_journal_release() races with do_journal_end() which requeues
    delayed works for transaction flushing, we can leave work items for
    flushing outstanding transactions queued while freeing them. That
    results in use after free and possible crash in run_timers_softirq().
    
    Fix the problem by not requeueing works if superblock is being shut down
    (MS_ACTIVE not set) and using cancel_delayed_work_sync() in
    do_journal_release().
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    [bwh: Backported to 3.2:
     - Adjust context
     - commit_wq is global, not per-superblock
     - Change comment about 'these works'; we only have one work item
     - Drop inapplicable changes to reiserfs_schedule_old_flush()]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    e1c88681
journal.c 122 KB