linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Matthew Wilcox <willy@infradead.org>,
	Jianglei Nie <niejianglei2021@163.com>
Cc: 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 18:25:59 +0800	[thread overview]
Message-ID: <YyBat53TZUK9trX/@MiWiFi-R3L-srv> (raw)
In-Reply-To: <YyAkpQNWXrkMGdYr@casper.infradead.org>

On 09/13/22 at 07:35am, Matthew Wilcox wrote:
> 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.

Right, that will cause problem. It's my fault since I suggested
the current change.

Jianglei, please use your v1 change and post again. Sorry for the
incorrect suggestion.


  reply	other threads:[~2022-09-13 10:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  6:25 [PATCH] proc/vmcore: fix potential memory leak in vmcore_init() Jianglei Nie
2022-09-13  6:35 ` Matthew Wilcox
2022-09-13 10:25   ` Baoquan He [this message]
  -- 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=YyBat53TZUK9trX/@MiWiFi-R3L-srv \
    --to=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 \
    --cc=willy@infradead.org \
    /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).