Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86b0624e authored by Jan Kara's avatar Jan Kara Committed by Vishal Verma
Browse files

ext2: Avoid DAX zeroing to corrupt data



Currently ext2 zeroes any data blocks allocated for DAX inode however it
still returns them as BH_New. Thus DAX code zeroes them again in
dax_insert_mapping() which can possibly overwrite the data that has been
already stored to those blocks by a racing dax_io(). Avoid marking
pre-zeroed buffers as new.

Reviewed-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarVishal Verma <vishal.l.verma@intel.com>
parent 9b6cd5f7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -745,11 +745,11 @@ static int ext2_get_blocks(struct inode *inode,
			mutex_unlock(&ei->truncate_mutex);
			goto cleanup;
		}
	}
	} else
		set_buffer_new(bh_result);

	ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
	mutex_unlock(&ei->truncate_mutex);
	set_buffer_new(bh_result);
got_it:
	map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
	if (count > blocks_to_boundary)