path: root/Documentation/
diff options
authorJan Kara <>2018-10-05 18:44:40 -0400
committerTheodore Ts'o <>2018-10-05 18:44:40 -0400
commitccd3c4373eacb044eb3832966299d13d2631f66f (patch)
treeef20ba8dba7c3d9346f31a2a559366beb71eac29 /Documentation/
parent182a79e0c17147d2c2d3990a9a7b6b58a1561c7a (diff)
jbd2: fix use after free in jbd2_log_do_checkpoint()
The code cleaning transaction's lists of checkpoint buffers has a bug where it increases bh refcount only after releasing journal->j_list_lock. Thus the following race is possible: CPU0 CPU1 jbd2_log_do_checkpoint() jbd2_journal_try_to_free_buffers() __journal_try_to_free_buffer(bh) ... while (transaction->t_checkpoint_io_list) ... if (buffer_locked(bh)) { <-- IO completes now, buffer gets unlocked --> spin_unlock(&journal->j_list_lock); spin_lock(&journal->j_list_lock); __jbd2_journal_remove_checkpoint(jh); spin_unlock(&journal->j_list_lock); try_to_free_buffers(page); get_bh(bh) <-- accesses freed bh Fix the problem by grabbing bh reference before unlocking journal->j_list_lock. Fixes: dc6e8d669cf5 ("jbd2: don't call get_bh() before calling __jbd2_journal_remove_checkpoint()") Fixes: be1158cc615f ("jbd2: fold __process_buffer() into jbd2_log_do_checkpoint()") Reported-by: CC: Reviewed-by: Lukas Czerner <> Signed-off-by: Jan Kara <> Signed-off-by: Theodore Ts'o <>
Diffstat (limited to 'Documentation/')
0 files changed, 0 insertions, 0 deletions