linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "sunny.s.zhang" <sunny.s.zhang@oracle.com>
To: Chengguang Xu <cgxu519@gmail.com>, jack@suse.com, tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] jbd2: fix potential double free
Date: Wed, 8 May 2019 14:38:22 +0800	[thread overview]
Message-ID: <a931ed92-763c-0a18-ed3d-4ac1c4fbcb8d@oracle.com> (raw)
In-Reply-To: <1557054064-3504-1-git-send-email-cgxu519@gmail.com>

Hi Chengguang,

在 2019年05月05日 19:01, Chengguang Xu 写道:
> When fail from creating cache jbd2_inode_cache, we will
> destroy previously created cache jbd2_handle_cache twice.
> This patch fixes it by removing first destroy in error path.
>
> Signed-off-by: Chengguang Xu <cgxu519@gmail.com>
> ---
>   fs/jbd2/journal.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 382c030cc78b..49797854ccb8 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2642,7 +2642,6 @@ static int __init jbd2_journal_init_handle_cache(void)
>   	jbd2_inode_cache = KMEM_CACHE(jbd2_inode, 0);
>   	if (jbd2_inode_cache == NULL) {
>   		printk(KERN_EMERG "JBD2: failed to create inode cache\n");
> -		kmem_cache_destroy(jbd2_handle_cache);
Maybe we should keep it, and set the jbd2_handle_cache to NULL.
If there are some changes in the future,  we may forget to change the 
function
of jbd2_journal_destroy_handle_cache.

Thanks,
Sunny

>   		return -ENOMEM;
>   	}
>   	return 0;


  parent reply	other threads:[~2019-05-08  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-05 11:01 [PATCH 1/3] jbd2: fix potential double free Chengguang Xu
2019-05-05 11:01 ` [PATCH 2/3] jbd2: code cleanup for jbd2_journal_init_revoke_caches() Chengguang Xu
2019-05-05 11:01 ` [PATCH 3/3] jbd2: add __init annotation for jbd2_journal_init_journal_head_cache() Chengguang Xu
2019-05-08  6:38 ` sunny.s.zhang [this message]
2019-05-09 10:42   ` [PATCH 1/3] jbd2: fix potential double free Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a931ed92-763c-0a18-ed3d-4ac1c4fbcb8d@oracle.com \
    --to=sunny.s.zhang@oracle.com \
    --cc=cgxu519@gmail.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).