aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/refcounttree.c
diff options
context:
space:
mode:
authorYingtai Xie <xieyingtai@huawei.com>2014-08-06 19:03:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:13 -0400
commit981035b47d7da8ba7c153ed431bf515f593853d8 (patch)
tree675aab83a7118389728f0dbcc733a3d3cf18ae8d /fs/ocfs2/refcounttree.c
parentc811f5f41e37d16b2839988426ffde78d2273d48 (diff)
ocfs2: correctly check the return value of ocfs2_search_extent_list
ocfs2_search_extent_list may return -1, so we should check the return value in ocfs2_split_and_insert, otherwise it may cause array index out of bound. And ocfs2_search_extent_list can only return value less than el->l_next_free_rec, so check if it is equal or larger than le16_to_cpu(el->l_next_free_rec) is meaningless. Signed-off-by: Yingtai Xie <xieyingtai@huawei.com> Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r--fs/ocfs2/refcounttree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 636aab69ead5..d81f6e2a97f5 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -3109,7 +3109,7 @@ static int ocfs2_clear_ext_refcount(handle_t *handle,
3109 el = path_leaf_el(path); 3109 el = path_leaf_el(path);
3110 3110
3111 index = ocfs2_search_extent_list(el, cpos); 3111 index = ocfs2_search_extent_list(el, cpos);
3112 if (index == -1 || index >= le16_to_cpu(el->l_next_free_rec)) { 3112 if (index == -1) {
3113 ocfs2_error(sb, 3113 ocfs2_error(sb,
3114 "Inode %llu has an extent at cpos %u which can no " 3114 "Inode %llu has an extent at cpos %u which can no "
3115 "longer be found.\n", 3115 "longer be found.\n",