Files
linux/fs
Ryusuke Konishi c043edcc42 nilfs2: fix sanity check of btree level in nilfs_btree_root_broken()
commit d8fd150fe3 upstream.

The range check for b-tree level parameter in nilfs_btree_root_broken()
is wrong; it accepts the case of "level == NILFS_BTREE_LEVEL_MAX" even
though the level is limited to values in the range of 0 to
(NILFS_BTREE_LEVEL_MAX - 1).

Since the level parameter is read from storage device and used to index
nilfs_btree_path array whose element count is NILFS_BTREE_LEVEL_MAX, it
can cause memory overrun during btree operations if the boundary value
is set to the level parameter on device.

This fixes the broken sanity check and adds a comment to clarify that
the upper bound NILFS_BTREE_LEVEL_MAX is exclusive.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-17 09:51:32 -07:00
..
2013-05-07 20:16:25 -07:00
2013-05-07 20:16:25 -07:00
2015-03-26 15:00:57 +01:00
2013-05-24 16:22:51 -07:00
2013-07-13 11:42:26 -07:00
2015-04-29 10:33:57 +02:00
2013-05-07 20:16:25 -07:00
2013-10-05 07:13:09 -07:00
2013-05-07 20:16:25 -07:00
2013-05-31 15:16:33 -04:00