Thread (7 messages) 7 messages, 2 authors, 2021-09-29

Re: [PATCH v2 1/3] fs/ntfs3: Fix memory leak if fill_super failed

From: Kari Argillander <hidden>
Date: 2021-09-28 17:44:40
Also in: lkml, ntfs3

On Tue, Sep 28, 2021 at 08:17:29PM +0300, Konstantin Komarov wrote:
quoted hunk ↗ jump to hunk
Restore fc->s_fs_info to free memory allocated in ntfs_init_fs_context.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
 fs/ntfs3/super.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 800897777eb0..aff90f70e7bf 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1242,6 +1242,10 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
 	return 0;
 out:
 	iput(inode);
+
+	/* Restore fc->s_fs_info to free memory allocated in ntfs_init_fs_context. */
+	fc->s_fs_info = sbi;
+
Nack. fc->s_fs_info is already pointing to sbi. We null this just before
we exit so it is impossible to be anything else in failure case.

	fc->fs_private = NULL;
	fc->s_fs_info = NULL;

	return 0;
out:
	iput(inode);
 	return err;
 }
 
-- 
2.33.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help