Messages in this thread Patch in this message | | | From | Denis Efremov <> | Subject | [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data | Date | Wed, 10 Jun 2020 01:14:46 +0300 |
| |
Use kfree() instead of kvfree() to free super in read_raw_super_block() because the memory is allocated with kzalloc() in the function. Use kfree() instead of kvfree() to free sbi, raw_super in f2fs_fill_super() and f2fs_put_super() because the memory is allocated with kzalloc().
Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed") Signed-off-by: Denis Efremov <efremov@linux.com> --- Changes in v2: - Single patch instead of two separate patches - kvfree fixed in f2fs_put_super Changes in v3: - raw_super added to the scope, thanks Chao Yu
fs/f2fs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8a9955902d84..7b458268ea09 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1241,7 +1241,7 @@ static void f2fs_put_super(struct super_block *sb) sb->s_fs_info = NULL; if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); - kvfree(sbi->raw_super); + kfree(sbi->raw_super); destroy_device_list(sbi); f2fs_destroy_xattr_caches(sbi); @@ -1257,7 +1257,7 @@ static void f2fs_put_super(struct super_block *sb) #ifdef CONFIG_UNICODE utf8_unload(sbi->s_encoding); #endif - kvfree(sbi); + kfree(sbi); } int f2fs_sync_fs(struct super_block *sb, int sync) @@ -3130,7 +3130,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, /* No valid superblock */ if (!*raw_super) - kvfree(super); + kfree(super); else err = 0; @@ -3808,11 +3808,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) fscrypt_free_dummy_context(&F2FS_OPTION(sbi).dummy_enc_ctx); kvfree(options); free_sb_buf: - kvfree(raw_super); + kfree(raw_super); free_sbi: if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); - kvfree(sbi); + kfree(sbi); /* give only one another chance */ if (retry_cnt > 0 && skip_recovery) { -- 2.26.2
| |