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:23:32 +0000 (10:23 +0200)
commit61decb58486d7c0cbded25fe4d301ab4fa148cd8
treec8c1b6f7637d2debeed831eb5a365e82b21a662b
parent00f1de9cffec26c4a80d36e8bf7509506825b360
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