fs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 11 Nov 2021 07:45:44 +0000 (08:45 +0100)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 23 Nov 2021 15:03:47 +0000 (18:03 +0300)
All error handling paths lead to 'out' where many resources are freed.

Do it as well here instead of a direct return, otherwise 'log', 'ra' and
'log->one_page_buf' (at least) will leak.

Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/fslog.c

index 06492f088d6020592bd4fdb8b1a6ecd22b823324..915f42cf07bcf85deee4a0ab7b74a985d18a9328 100644 (file)
@@ -4085,8 +4085,10 @@ process_log:
                if (client == LFS_NO_CLIENT_LE) {
                        /* Insert "NTFS" client LogFile. */
                        client = ra->client_idx[0];
-                       if (client == LFS_NO_CLIENT_LE)
-                               return -EINVAL;
+                       if (client == LFS_NO_CLIENT_LE) {
+                               err = -EINVAL;
+                               goto out;
+                       }
 
                        t16 = le16_to_cpu(client);
                        cr = ca + t16;