* [PATCH 1/2] f2fs: use kfree() to free super in read_raw_super_block()
@ 2020-06-05 18:15 ` Denis Efremov
0 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-05 18:15 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: Denis Efremov, linux-f2fs-devel, linux-kernel
Use kfree() instead of kvfree() to free super in
read_raw_super_block() because the memory is allocated with
kzalloc() in the function.
Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
Signed-off-by: Denis Efremov <efremov@linux.com>
---
fs/f2fs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8a9955902d84..9a3c8eba37e2 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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;
--
2.26.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [f2fs-dev] [PATCH 1/2] f2fs: use kfree() to free super in read_raw_super_block()
@ 2020-06-05 18:15 ` Denis Efremov
0 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-05 18:15 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, Denis Efremov, linux-f2fs-devel
Use kfree() instead of kvfree() to free super in
read_raw_super_block() because the memory is allocated with
kzalloc() in the function.
Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
Signed-off-by: Denis Efremov <efremov@linux.com>
---
fs/f2fs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8a9955902d84..9a3c8eba37e2 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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;
--
2.26.2
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2] f2fs: use kfree() to free sbi in f2fs_fill_super()
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
@ 2020-06-05 18:15 ` Denis Efremov
-1 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-05 18:15 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: Denis Efremov, linux-f2fs-devel, linux-kernel
Use kfree() instead of kvfree() to free sbi in
f2fs_fill_super() because the memory is allocated with
kzalloc() in the function.
Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
Signed-off-by: Denis Efremov <efremov@linux.com>
---
fs/f2fs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 9a3c8eba37e2..39b644c7e9d4 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3812,7 +3812,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [f2fs-dev] [PATCH 2/2] f2fs: use kfree() to free sbi in f2fs_fill_super()
@ 2020-06-05 18:15 ` Denis Efremov
0 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-05 18:15 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, Denis Efremov, linux-f2fs-devel
Use kfree() instead of kvfree() to free sbi in
f2fs_fill_super() because the memory is allocated with
kzalloc() in the function.
Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
Signed-off-by: Denis Efremov <efremov@linux.com>
---
fs/f2fs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 9a3c8eba37e2..39b644c7e9d4 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3812,7 +3812,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
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
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 1/2] f2fs: use kfree() to free super in read_raw_super_block()
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
@ 2020-06-08 2:47 ` Chao Yu
-1 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-08 2:47 UTC (permalink / raw)
To: Denis Efremov, Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
On 2020/6/6 2:15, Denis Efremov wrote:
> Use kfree() instead of kvfree() to free super in
> read_raw_super_block() because the memory is allocated with
> kzalloc() in the function.
>
> Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
> Signed-off-by: Denis Efremov <efremov@linux.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 1/2] f2fs: use kfree() to free super in read_raw_super_block()
@ 2020-06-08 2:47 ` Chao Yu
0 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-08 2:47 UTC (permalink / raw)
To: Denis Efremov, Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
On 2020/6/6 2:15, Denis Efremov wrote:
> Use kfree() instead of kvfree() to free super in
> read_raw_super_block() because the memory is allocated with
> kzalloc() in the function.
>
> Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
> Signed-off-by: Denis Efremov <efremov@linux.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: use kfree() to free sbi in f2fs_fill_super()
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
@ 2020-06-08 2:51 ` Chao Yu
-1 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-08 2:51 UTC (permalink / raw)
To: Denis Efremov, Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
On 2020/6/6 2:15, Denis Efremov wrote:
> Use kfree() instead of kvfree() to free sbi in
> f2fs_fill_super() because the memory is allocated with
> kzalloc() in the function.
Could you fix them in one patch?
In addition, we need to fix them in f2fs_put_super() as well.
Thanks,
>
> Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
> fs/f2fs/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 9a3c8eba37e2..39b644c7e9d4 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -3812,7 +3812,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> 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) {
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: use kfree() to free sbi in f2fs_fill_super()
@ 2020-06-08 2:51 ` Chao Yu
0 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-08 2:51 UTC (permalink / raw)
To: Denis Efremov, Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
On 2020/6/6 2:15, Denis Efremov wrote:
> Use kfree() instead of kvfree() to free sbi in
> f2fs_fill_super() because the memory is allocated with
> kzalloc() in the function.
Could you fix them in one patch?
In addition, we need to fix them in f2fs_put_super() as well.
Thanks,
>
> Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed")
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
> fs/f2fs/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 9a3c8eba37e2..39b644c7e9d4 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -3812,7 +3812,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> 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) {
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2] f2fs: use kfree() instead of kvfree() to free superblock data
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
@ 2020-06-08 15:41 ` Denis Efremov
-1 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-08 15:41 UTC (permalink / raw)
To: Chao Yu, Jaegeuk Kim; +Cc: Denis Efremov, linux-f2fs-devel, linux-kernel
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 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
fs/f2fs/super.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8a9955902d84..94bfc140bef9 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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;
@@ -3812,7 +3812,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [f2fs-dev] [PATCH v2] f2fs: use kfree() instead of kvfree() to free superblock data
@ 2020-06-08 15:41 ` Denis Efremov
0 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-08 15:41 UTC (permalink / raw)
To: Chao Yu, Jaegeuk Kim; +Cc: linux-kernel, Denis Efremov, linux-f2fs-devel
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 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
fs/f2fs/super.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8a9955902d84..94bfc140bef9 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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;
@@ -3812,7 +3812,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
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
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2] f2fs: use kfree() instead of kvfree() to free superblock data
2020-06-08 15:41 ` [f2fs-dev] " Denis Efremov
@ 2020-06-09 1:22 ` Chao Yu
-1 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-09 1:22 UTC (permalink / raw)
To: Denis Efremov, Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel
Hello Denis,
On 2020/6/8 23:41, Denis Efremov wrote:
> 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 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>
I found two missing cases, so how about this?
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index f3c151169542..f913a63e93f0 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1206,7 +1206,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);
@@ -1221,7 +1221,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)
@@ -3101,7 +3101,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;
@@ -3779,11 +3779,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
#endif
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) {
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: use kfree() instead of kvfree() to free superblock data
@ 2020-06-09 1:22 ` Chao Yu
0 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-09 1:22 UTC (permalink / raw)
To: Denis Efremov, Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel
Hello Denis,
On 2020/6/8 23:41, Denis Efremov wrote:
> 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 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>
I found two missing cases, so how about this?
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index f3c151169542..f913a63e93f0 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1206,7 +1206,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);
@@ -1221,7 +1221,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)
@@ -3101,7 +3101,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;
@@ -3779,11 +3779,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
#endif
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) {
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
@ 2020-06-09 22:14 ` Denis Efremov
-1 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-09 22:14 UTC (permalink / raw)
To: Chao Yu, Jaegeuk Kim; +Cc: Denis Efremov, linux-f2fs-devel, linux-kernel
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [f2fs-dev] [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
@ 2020-06-09 22:14 ` Denis Efremov
0 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-06-09 22:14 UTC (permalink / raw)
To: Chao Yu, Jaegeuk Kim; +Cc: linux-kernel, Denis Efremov, linux-f2fs-devel
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
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
2020-06-09 22:14 ` [f2fs-dev] " Denis Efremov
@ 2020-06-09 22:25 ` Eric Biggers
-1 siblings, 0 replies; 20+ messages in thread
From: Eric Biggers @ 2020-06-09 22:25 UTC (permalink / raw)
To: Denis Efremov; +Cc: Chao Yu, Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote:
> 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>
I don't think "Fixes" is appropriate here.
kvfree() still works on kmalloc'ed memory; it's just not preferred.
So this is more a cleanup than a fix.
- Eric
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
@ 2020-06-09 22:25 ` Eric Biggers
0 siblings, 0 replies; 20+ messages in thread
From: Eric Biggers @ 2020-06-09 22:25 UTC (permalink / raw)
To: Denis Efremov; +Cc: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote:
> 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>
I don't think "Fixes" is appropriate here.
kvfree() still works on kmalloc'ed memory; it's just not preferred.
So this is more a cleanup than a fix.
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
2020-06-09 22:25 ` [f2fs-dev] " Eric Biggers
@ 2020-06-15 17:58 ` Jaegeuk Kim
-1 siblings, 0 replies; 20+ messages in thread
From: Jaegeuk Kim @ 2020-06-15 17:58 UTC (permalink / raw)
To: Eric Biggers; +Cc: Denis Efremov, Chao Yu, linux-kernel, linux-f2fs-devel
On 06/09, Eric Biggers wrote:
> On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote:
> > 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>
>
> I don't think "Fixes" is appropriate here.
Agreed. I queued this Cl without it. :)
Thanks,
>
> kvfree() still works on kmalloc'ed memory; it's just not preferred.
>
> So this is more a cleanup than a fix.
>
> - Eric
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
@ 2020-06-15 17:58 ` Jaegeuk Kim
0 siblings, 0 replies; 20+ messages in thread
From: Jaegeuk Kim @ 2020-06-15 17:58 UTC (permalink / raw)
To: Eric Biggers; +Cc: linux-kernel, Denis Efremov, linux-f2fs-devel
On 06/09, Eric Biggers wrote:
> On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote:
> > 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>
>
> I don't think "Fixes" is appropriate here.
Agreed. I queued this Cl without it. :)
Thanks,
>
> kvfree() still works on kmalloc'ed memory; it's just not preferred.
>
> So this is more a cleanup than a fix.
>
> - Eric
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
2020-06-15 17:58 ` [f2fs-dev] " Jaegeuk Kim
@ 2020-06-18 3:28 ` Chao Yu
-1 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-18 3:28 UTC (permalink / raw)
To: Jaegeuk Kim, Eric Biggers; +Cc: Denis Efremov, linux-kernel, linux-f2fs-devel
On 2020/6/16 1:58, Jaegeuk Kim wrote:
> On 06/09, Eric Biggers wrote:
>> On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote:
>>> 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>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
>>
>> I don't think "Fixes" is appropriate here.
>
> Agreed. I queued this Cl without it. :)
> Thanks,
>
>>
>> kvfree() still works on kmalloc'ed memory; it's just not preferred.
>>
>> So this is more a cleanup than a fix.
>>
>> - Eric
> .
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data
@ 2020-06-18 3:28 ` Chao Yu
0 siblings, 0 replies; 20+ messages in thread
From: Chao Yu @ 2020-06-18 3:28 UTC (permalink / raw)
To: Jaegeuk Kim, Eric Biggers; +Cc: linux-kernel, Denis Efremov, linux-f2fs-devel
On 2020/6/16 1:58, Jaegeuk Kim wrote:
> On 06/09, Eric Biggers wrote:
>> On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote:
>>> 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>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
>>
>> I don't think "Fixes" is appropriate here.
>
> Agreed. I queued this Cl without it. :)
> Thanks,
>
>>
>> kvfree() still works on kmalloc'ed memory; it's just not preferred.
>>
>> So this is more a cleanup than a fix.
>>
>> - Eric
> .
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2020-06-18 3:28 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 18:15 [PATCH 1/2] f2fs: use kfree() to free super in read_raw_super_block() Denis Efremov
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
2020-06-05 18:15 ` [PATCH 2/2] f2fs: use kfree() to free sbi in f2fs_fill_super() Denis Efremov
2020-06-05 18:15 ` [f2fs-dev] " Denis Efremov
2020-06-08 2:51 ` Chao Yu
2020-06-08 2:51 ` Chao Yu
2020-06-08 2:47 ` [f2fs-dev] [PATCH 1/2] f2fs: use kfree() to free super in read_raw_super_block() Chao Yu
2020-06-08 2:47 ` Chao Yu
2020-06-08 15:41 ` [PATCH v2] f2fs: use kfree() instead of kvfree() to free superblock data Denis Efremov
2020-06-08 15:41 ` [f2fs-dev] " Denis Efremov
2020-06-09 1:22 ` Chao Yu
2020-06-09 1:22 ` [f2fs-dev] " Chao Yu
2020-06-09 22:14 ` [PATCH v3] " Denis Efremov
2020-06-09 22:14 ` [f2fs-dev] " Denis Efremov
2020-06-09 22:25 ` Eric Biggers
2020-06-09 22:25 ` [f2fs-dev] " Eric Biggers
2020-06-15 17:58 ` Jaegeuk Kim
2020-06-15 17:58 ` [f2fs-dev] " Jaegeuk Kim
2020-06-18 3:28 ` Chao Yu
2020-06-18 3:28 ` [f2fs-dev] " Chao Yu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.