• wangyan's avatar
    ocfs2: fix a NULL pointer dereference when call ocfs2_update_inode_fsync_trans() · 9f16ca48
    wangyan authored
    I found a NULL pointer dereference in ocfs2_update_inode_fsync_trans(),
    handle->h_transaction may be NULL in this situation:
    
    ocfs2_file_write_iter
      ->__generic_file_write_iter
          ->generic_perform_write
            ->ocfs2_write_begin
              ->ocfs2_write_begin_nolock
                ->ocfs2_write_cluster_by_desc
                  ->ocfs2_write_cluster
                    ->ocfs2_mark_extent_written
                      ->ocfs2_change_extent_flag
                        ->ocfs2_split_extent
                          ->ocfs2_try_to_merge_extent
                            ->ocfs2_extend_rotate_transaction
                              ->ocfs2_extend_trans
                                ->jbd2_journal_restart
                                  ->jbd2__journal_restart
                                    // handle->h_transaction is NULL here
                                    ->handle->h_transaction = NULL;
                                    ->start_this_handle
                ...
    9f16ca48
journal.h 21.5 KB