fs/ntfs3: Fix invalid free in log_replay
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 30 May 2022 15:43:01 +0000 (18:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:26:32 +0000 (10:26 +0200)
commit2088cc00491e8d25a99d0f247df843e9c3df2040
tree9c1b7dea8396c97bc1242d25f8b1e0e5695ea1c9
parent1ac3e2f7492d162b251091a8684fa65621bf82dd
fs/ntfs3: Fix invalid free in log_replay

commit f26967b9f7a830e228bb13fb41bd516ddd9d789d upstream.

log_read_rst() returns ENOMEM error when there is not enough memory.
In this case, if info is returned without initialization,
it attempts to kfree the uninitialized info->r_page pointer. This patch
moves the memset initialization code to before log_read_rst() is called.

Reported-by: Gerald Lee <sundaywind2004@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ntfs3/fslog.c