kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Long Li <longli@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/2] uio_hv_generic: Fix a memory leak in error handling paths
Date: Tue, 18 May 2021 21:53:19 +0000	[thread overview]
Message-ID: <20210518215319.yshxwkvxaxsv77bv@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <BY5PR21MB15069658A7DE04A863C75036CE2C9@BY5PR21MB1506.namprd21.prod.outlook.com>

On Tue, May 18, 2021 at 09:50:17PM +0000, Long Li wrote:
> > Subject: Re: [PATCH 1/2] uio_hv_generic: Fix a memory leak in error handling
> > paths
> > 
> > Cc Long Li.
> > 
> > Long, Stephen suggested I check with you. Do you have any opinion?
> > 
> > Wei.
> > 
> > On Tue, May 11, 2021 at 09:52:27AM +0000, Wei Liu wrote:
> > > On Sun, May 09, 2021 at 09:13:03AM +0200, Christophe JAILLET wrote:
> > > > If 'vmbus_establish_gpadl()' fails, the (recv|send)_gpadl will not
> > > > be updated and 'hv_uio_cleanup()' in the error handling path will
> > > > not be able to free the corresponding buffer.
> > > >
> > > > In such a case, we need to free the buffer explicitly.
> > > >
> > > > Fixes: cdfa835c6e5e ("uio_hv_generic: defer opening vmbus until
> > > > first use")
> > > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > > > ---
> > > > Before commit cdfa835c6e5e, the 'vfree' were done unconditionally in
> > > > 'hv_uio_cleanup()'.
> > > > So, another way for fixing the potential leak is to modify
> > > > 'hv_uio_cleanup()' and revert to the previous behavior.
> > > >
> > >
> > > I think this is cleaner.
> 
> Christophe has mentioned that the patch is already picked up by Greg KH.
> 
> I think both approaches are correct. We can go with this one.

OK. That's fine.

Wei.

      reply	other threads:[~2021-05-18 21:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09  7:13 [PATCH 1/2] uio_hv_generic: Fix a memory leak in error handling paths Christophe JAILLET
2021-05-09  7:13 ` [PATCH 2/2] uio_hv_generic: Fix another " Christophe JAILLET
2021-05-11  9:52 ` [PATCH 1/2] uio_hv_generic: Fix a " Wei Liu
2021-05-11 18:18   ` Christophe JAILLET
2021-05-15 16:09     ` Wei Liu
2021-05-18 20:46       ` Christophe JAILLET
2021-05-18 11:01   ` Wei Liu
2021-05-18 21:50     ` Long Li
2021-05-18 21:53       ` Wei Liu [this message]

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=20210518215319.yshxwkvxaxsv77bv@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=decui@microsoft.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=sthemmin@microsoft.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;
as well as URLs for NNTP newsgroup(s).