提交 6cae6d31 编写于 作者: J Joseph Qi 提交者: Linus Torvalds

ocfs2: fix possible double free in ocfs2_reflink_xattr_rec

In ocfs2_reflink_xattr_rec(), meta_ac and data_ac are allocated by calling
ocfs2_lock_reflink_xattr_rec_allocators().

Once an error occurs when allocating *data_ac, it frees *meta_ac which is
allocated before.  Here it mistakenly sets meta_ac to NULL but *meta_ac.
Then ocfs2_reflink_xattr_rec() will try to free meta_ac again which is
already invalid.
Signed-off-by: NJoseph Qi <joseph.qi@huawei.com>
Reviewed-by: NJie Liu <jeff.liu@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 69b2bd16
......@@ -6802,7 +6802,7 @@ static int ocfs2_lock_reflink_xattr_rec_allocators(
if (ret) {
if (*meta_ac) {
ocfs2_free_alloc_context(*meta_ac);
meta_ac = NULL;
*meta_ac = NULL;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册