]> git.ipfire.org Git - people/arne_f/kernel.git/commit
f2fs: fix overflow due to condition check order
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 23 Nov 2016 18:51:17 +0000 (10:51 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Jan 2017 10:16:22 +0000 (11:16 +0100)
commitbf0f02079039146620f90125efe8ae778db9a729
treef45fb38d2b049232e4ff8e2b1404e5974edad5e1
parent154d83a8384eb5b8747008fcad8696a3a2845abf
f2fs: fix overflow due to condition check order

commit e87f7329bbd6760c2acc4f1eb423362b08851a71 upstream.

In the last ilen case, i was already increased, resulting in accessing out-
of-boundary entry of do_replace and blkaddr.
Fix to check ilen first to exit the loop.

Fixes: 2aa8fbb9693020 ("f2fs: refactor __exchange_data_block for speed up")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/file.c