(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

nilfs2: strengthen consistency checks in nilfs_direct_propagate()

nilfs_direct_propagate() is responsible for updating the virtual block number associated with a dirty data block in the direct mapping. It is not designed to handle intermediate node blocks. Furthermore, it assumes that the block offset of the passed buffer head is within the range of NILFS_DIRECT_KEY_MAX; otherwise, an out-of-bounds memory access could occur within the inode containing the bmap root. While such inconsistencies stem from bugs, they can cause silent, harmful side effects unless a debug kernel is used - as was the case with a recent slab out-of-bounds access issue found in this function. Therefore, issue a kernel warning via WARN_ON_ONCE() and return -EINVAL for these anomalies, allowing the bmap layer to handle the situation as a filesystem error. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>


Author Ryusuke Konishi Committer Viacheslav Dubeyko Date Commit Parent cee9395a
+6
1 changed file
+6
1 changed file