[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210518215319.yshxwkvxaxsv77bv@liuwe-devbox-debian-v2>
Date: Tue, 18 May 2021 21:53:19 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Long Li <longli@...rosoft.com>
Cc: Wei Liu <wei.liu@...nel.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Dexuan Cui <decui@...rosoft.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH 1/2] uio_hv_generic: Fix a memory leak in error handling
paths
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@...adoo.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.
Powered by blists - more mailing lists