]> git.baikalelectronics.ru Git - kernel.git/commit
nilfs2: verify metadata sizes read from disk
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Thu, 3 Apr 2014 21:50:31 +0000 (14:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Apr 2014 23:21:26 +0000 (16:21 -0700)
commit11e8b091de49916138be9f6b2cb29bff6be8f3ef
treea4c2d5ca63ffabde64759d2c238773d7114e34b7
parent532c70a0bfebeabab8b302a05c542139e1ba22f3
nilfs2: verify metadata sizes read from disk

Add code to check sizes of on-disk data of metadata files such as inode
size, segment usage size, DAT entry size, and checkpoint size.  Although
these sizes are read from disk, the current implementation doesn't check
them.

If these sizes are not sane on disk, it can cause out-of-range access to
metadata or memory access overrun on metadata block buffers due to
overflow in sundry calculations.

Both lower limit and upper limit of metadata sizes are verified to
prevent these issues.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Andreas Rohner <andreas.rohner@gmx.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nilfs2/cpfile.c
fs/nilfs2/dat.c
fs/nilfs2/sufile.c
fs/nilfs2/the_nilfs.c
include/linux/nilfs2_fs.h