linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix double free of unicode map
@ 2020-11-12  8:02 Hyeongseok Kim
  2020-11-12  8:17 ` [f2fs-dev] " Eric Biggers
  0 siblings, 1 reply; 3+ messages in thread
From: Hyeongseok Kim @ 2020-11-12  8:02 UTC (permalink / raw)
  To: yuchao0, jaegeuk
  Cc: linux-f2fs-devel, linux-fsdevel, hyeongseok.kim, Hyeongseok Kim

In case of retrying fill_super with skip_recovery,
s_encoding for casefold would not be loaded again even though it's
already been freed because it's not NULL.
Set NULL after free to prevent double freeing when unmount.

Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
---
 fs/f2fs/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 00eff2f51807..fef22e476c52 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3918,6 +3918,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 
 #ifdef CONFIG_UNICODE
 	utf8_unload(sb->s_encoding);
+	sb->s_encoding = NULL;
 #endif
 free_options:
 #ifdef CONFIG_QUOTA
-- 
2.27.0.83.g0313f36


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix double free of unicode map
  2020-11-12  8:02 [PATCH] f2fs: fix double free of unicode map Hyeongseok Kim
@ 2020-11-12  8:17 ` Eric Biggers
  2020-11-12  8:30   ` hyeongseok
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2020-11-12  8:17 UTC (permalink / raw)
  To: Hyeongseok Kim
  Cc: yuchao0, jaegeuk, linux-fsdevel, hyeongseok.kim,
	linux-f2fs-devel, Daniel Rosenberg

On Thu, Nov 12, 2020 at 05:02:01PM +0900, Hyeongseok Kim wrote:
> In case of retrying fill_super with skip_recovery,
> s_encoding for casefold would not be loaded again even though it's
> already been freed because it's not NULL.
> Set NULL after free to prevent double freeing when unmount.
> 
> Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
> ---
>  fs/f2fs/super.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 00eff2f51807..fef22e476c52 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -3918,6 +3918,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>  
>  #ifdef CONFIG_UNICODE
>  	utf8_unload(sb->s_encoding);
> +	sb->s_encoding = NULL;
>  #endif
>  free_options:
>  #ifdef CONFIG_QUOTA
> -- 

This is:

Fixes: eca4873ee1b6 ("f2fs: Use generic casefolding support")

Right?

- Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix double free of unicode map
  2020-11-12  8:17 ` [f2fs-dev] " Eric Biggers
@ 2020-11-12  8:30   ` hyeongseok
  0 siblings, 0 replies; 3+ messages in thread
From: hyeongseok @ 2020-11-12  8:30 UTC (permalink / raw)
  To: Eric Biggers
  Cc: yuchao0, jaegeuk, linux-fsdevel, hyeongseok.kim,
	linux-f2fs-devel, Daniel Rosenberg

On 11/12/20 5:17 PM, Eric Biggers wrote:
> On Thu, Nov 12, 2020 at 05:02:01PM +0900, Hyeongseok Kim wrote:
>> In case of retrying fill_super with skip_recovery,
>> s_encoding for casefold would not be loaded again even though it's
>> already been freed because it's not NULL.
>> Set NULL after free to prevent double freeing when unmount.
>>
>> Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
>> ---
>>   fs/f2fs/super.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>> index 00eff2f51807..fef22e476c52 100644
>> --- a/fs/f2fs/super.c
>> +++ b/fs/f2fs/super.c
>> @@ -3918,6 +3918,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>>   
>>   #ifdef CONFIG_UNICODE
>>   	utf8_unload(sb->s_encoding);
>> +	sb->s_encoding = NULL;
>>   #endif
>>   free_options:
>>   #ifdef CONFIG_QUOTA
>> -- 
> This is:
>
> Fixes: eca4873ee1b6 ("f2fs: Use generic casefolding support")
>
> Right?
>
> - Eric
>
Right. Should I add "Fixes" tag and send v2?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-12  8:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12  8:02 [PATCH] f2fs: fix double free of unicode map Hyeongseok Kim
2020-11-12  8:17 ` [f2fs-dev] " Eric Biggers
2020-11-12  8:30   ` hyeongseok

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).