]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: check name_len of dir entry to prevent from deadloop
authorChao Yu <chao2.yu@samsung.com>
Thu, 10 Jul 2014 04:37:46 +0000 (12:37 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 11 Jul 2014 00:00:02 +0000 (17:00 -0700)
commita5374480226458f62619118194a2363e883eef4a
tree9956bcdeaaa8d717330ef9c2972b1495efd9c138
parent14ae43fce561e0456782a7a7c534f1fe27a5cca3
f2fs: check name_len of dir entry to prevent from deadloop

We assume that modification of some special application could result in zeroed
name_len, or it is consciously made by somebody. We will deadloop in
find_in_block when name_len of dir entry is zero.

This patch is added for preventing deadloop in above scenario.

change log from v1:
 o use f2fs_bug_on rather than break out from searching dir entry suggested by
Jaegeuk Kim.

Jaegeuk describe:
"Well, IMO, it would be good to add f2fs_bug_on() here with a specific comment.
In the current phase of f2fs, it is more important to investigate the file
system bugs, rather than workarounds for any corrupted images.
And, definitely it needs to stop the kernel if any corrupted image was mounted,
so that we can figure out where the bugs are occurred."

Suggested-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c