Skip to content

Commit

Permalink
fs/ntfs3: Fix memory leak if fill_super failed
Browse files Browse the repository at this point in the history
Restore fc->s_fs_info to free memory allocated in ntfs_init_fs_context.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
  • Loading branch information
aalexandrovich authored and intel-lab-lkp committed Sep 29, 2021
1 parent 5816b3e commit 82c276f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/ntfs3/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,9 @@ int ntfs_discard(struct ntfs_sb_info *sbi, CLST lcn, CLST len)
if (err == -EOPNOTSUPP)
sbi->flags |= NTFS_FLAGS_NODISCARD;

/* Restore fc->s_fs_info to free memory allocated in ntfs_init_fs_context. */
fc->s_fs_info = sbi;

return err;
}

Expand Down

0 comments on commit 82c276f

Please sign in to comment.