mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Jianglei Nie <niejianglei2021@163.com>
Cc: bhe@redhat.com, vgoyal@redhat.com, dyoung@redhat.com,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] proc/vmcore: fix potential memory leak in vmcore_init()
Date: Tue, 13 Sep 2022 07:35:17 +0100	[thread overview]
Message-ID: <YyAkpQNWXrkMGdYr@casper.infradead.org> (raw)
In-Reply-To: <20220913062501.82546-1-niejianglei2021@163.com>

On Tue, Sep 13, 2022 at 02:25:01PM +0800, Jianglei Nie wrote:
>  	}
> -	elfcorehdr_free(elfcorehdr_addr);
>  	elfcorehdr_addr = ELFCORE_ADDR_ERR;
>  
>  	proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &vmcore_proc_ops);
>  	if (proc_vmcore)
>  		proc_vmcore->size = vmcore_size;
> -	return 0;
> +
> +fail:
> +	elfcorehdr_free(elfcorehdr_addr);
> +	return rc;
>  }

Did you test this?  It looks like you now call
elfcorehdr_free(ELFCORE_ADDR_ERR) if 'rc' is 0.

  reply	other threads:[~2022-09-13  6:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  6:25 Jianglei Nie
2022-09-13  6:35 ` Matthew Wilcox [this message]
2022-09-13 10:25   ` Baoquan He
  -- strict thread matches above, loose matches on Subject: below --
2022-06-29 16:52 Jianglei Nie
2022-07-04  2:54 ` Baoquan He

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=YyAkpQNWXrkMGdYr@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niejianglei2021@163.com \
    --cc=vgoyal@redhat.com \
    /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

all inboxes | Powered by JetHome®