Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udf: Fix lost writes in udf_adinicb_writepage()

The patch converting udf_adinicb_writepage() to avoid manually kmapping
the page used memcpy_to_page() however that copies in the wrong
direction (effectively overwriting file data with the old contents).
What we should be using is memcpy_from_page() to copy data from the page
into the inode and then mark inode dirty to store the data.

Fixes: 5cfc45321a6d ("udf: Convert udf_adinicb_writepage() to memcpy_to_page()")
Signed-off-by: Jan Kara <jack@suse.cz>

Jan Kara 49854d3c fe15c26e

+1 -1
+1 -1
fs/udf/inode.c
··· 193 193 struct udf_inode_info *iinfo = UDF_I(inode); 194 194 195 195 BUG_ON(!PageLocked(page)); 196 - memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr, 196 + memcpy_from_page(iinfo->i_data + iinfo->i_lenEAttr, page, 0, 197 197 i_size_read(inode)); 198 198 unlock_page(page); 199 199 mark_inode_dirty(inode);