]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ocfs2: fix memory leak in ocfs2_merge_rec_left()
authorDmitry Antipov <dmantipov@yandex.ru>
Fri, 5 Dec 2025 06:51:59 +0000 (09:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:40 +0000 (13:09 +0100)
[ Upstream commit 2214ec4bf89d0fd27717322d3983a2f3b469c7f3 ]

In 'ocfs2_merge_rec_left()', do not reset 'left_path' to NULL after
move, thus allowing 'ocfs2_free_path()' to free it before return.

Link: https://lkml.kernel.org/r/20251205065159.392749-1-dmantipov@yandex.ru
Fixes: 677b975282e4 ("ocfs2: Add support for cross extent block")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reported-by: syzbot+cfc7cab3bb6eaa7c4de2@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=cfc7cab3bb6eaa7c4de2
Reviewed-by: Heming Zhao <heming.zhao@suse.com>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ocfs2/alloc.c

index 9c95d911a14b1ae59203fd3c08ef7c32ec3ab995..9589b462b5913ef49330665f98dd3c32391f4a2d 100644 (file)
@@ -3647,7 +3647,6 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
                         * So we use the new rightmost path.
                         */
                        ocfs2_mv_path(right_path, left_path);
-                       left_path = NULL;
                } else
                        ocfs2_complete_edge_insert(handle, left_path,
                                                   right_path, subtree_index);