Re: [PATCH v2] jbd2: fix potential double free

From: Theodore Ts'o
Date: Sat May 11 2019 - 13:43:04 EST


On Fri, May 10, 2019 at 06:36:48PM +0800, Chengguang Xu wrote:
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 37e16d969925..0f1ac43d0560 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2299,7 +2299,7 @@ static void jbd2_journal_destroy_slabs(void)
> }
> }
>
> -static int jbd2_journal_create_slab(size_t size)
> +static int __init jbd2_journal_create_slab(size_t size)
> {
> static DEFINE_MUTEX(jbd2_slab_create_mutex);
> int i = order_base_2(size) - 10;

I had to remove this hunk. It's incorrect, since jbd2_journal_load
calls this function when mounting file systems. So it can't be marked
__init.

- Ted