In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to truncate meta inode pages forcely
Below race case can cause data corruption:
Thread A GC thread - gcdatasegment - radatablock - locked metainode page - f2fsinplacewritedata - invalidatemappingpages : fail to invalidate metainode page due to lock failure or dirty|writeback status - f2fssubmitpagebio : write last dirty data to old blkaddr - movedatablock - load old data from metainode page - f2fssubmitpagewrite : write old data to new blkaddr
Because invalidatemappingpages() will skip invalidating page which has unclear status including locked, dirty, writeback and so on, so we need to use truncateinodepagesrange() instead of invalidatemappingpages() to make sure metainode page will be dropped.